Merge pull request #9029 from skyace65/DodgeCreeps

Fix and update Dodge the Creeps Issues
This commit is contained in:
Max Hilbrunner
2024-03-02 20:55:26 +01:00
committed by GitHub
5 changed files with 21 additions and 21 deletions
@@ -269,6 +269,20 @@ what the *PathFollow* node's ``progress_ratio`` expects:
The path we have set is around the camera's viewport, so any random value between 0 and 1
is a random position alongside the edges of the viewport!
Note that if you remove the ``Player`` from the main scene, the following line
.. tabs::
.. code-tab:: gdscript GDScript
var player_position = $Player.position
.. code-tab:: csharp
Vector3 playerPosition = GetNode<Player>("Player").Position;
gives an error because there is no $Player!
Here is the complete ``main.gd`` script so far, for reference.
.. tabs::
@@ -100,25 +100,6 @@ a ``die()`` function that helps us put a descriptive label on the code.
Die();
}
Try the game again by pressing :kbd:`F5`. If everything is set up correctly,
the character should die when an enemy runs into the collider. Note that without a ``Player``, the following line
.. tabs::
.. code-tab:: gdscript GDScript
var player_position = $Player.position
.. code-tab:: csharp
Vector3 playerPosition = GetNode<Player>("Player").Position;
gives an error because there is no $Player!
Also note that the enemy colliding with the player and dying depends on the size and position of the
``Player`` and the ``Mob``\ 's collision shapes. You may need to move them
and resize them to achieve a tight game feel.
Ending the game
---------------
@@ -153,6 +134,10 @@ and the remaining ones will leave the screen.
Notice also that the game no longer crashes or displays an error when the player dies. Because
we are stopping the MobTimer, it no longer triggers the ``_on_mob_timer_timeout()`` function.
Also note that the enemy colliding with the player and dying depends on the size and position of the
``Player`` and the ``Mob``\ 's collision shapes. You may need to move them
and resize them to achieve a tight game feel.
You can pat yourself in the back: you prototyped a complete 3D game,
even if it's still a bit rough.
@@ -43,7 +43,7 @@ time in seconds.
We want the animation to start playback automatically at the start of the game.
Also, it should loop.
To do so, you can click the button with an "A>" icon in the animation toolbar
To do so, you can click the autoplay button (|Autoplay|) in the animation toolbar
and the looping arrows, respectively.
|image5|
@@ -271,7 +271,7 @@ should see the message "Global library will be created." Leave the text field bl
click OK. Click the *Paste* icon (clipboard) and it should appear in the window. Click OK
to close the window.
Next, make sure that the button with an "A>" icon (Autoplay on Load) and the looping
Next, make sure that the autoplay button (|Autoplay|) and the looping
arrows (Animation looping) are also turned on in the animation editor in the bottom panel.
That's it; all monsters will now play the float animation.
@@ -639,3 +639,4 @@ And the *Mob*'s script.
.. |animation_final_keyframes| image:: img/09.adding_animations/animation_final_keyframes.webp
.. |second_keys_both| image:: img/09.adding_animations/second_keys_both.webp
.. |timeline_05_click| image:: img/09.adding_animations/timeline_05_click.webp
.. |Autoplay| image:: img/09.adding_animations/
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B