Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
gdevelop5:tutorials:platform-game:2-player-animations [2018/09/12 01:07]
4ian
gdevelop5:tutorials:platform-game:2-player-animations [2018/09/12 01:19] (current)
4ian
Line 98: Line 98:
 ## Idle and running animation ## Idle and running animation
  
-Let add a new blank event. Click on 'Add condition'​ and this time select the condition 'Is on floor' inside the Platformer ​behaviour ​category. Note that you can use the search box on the top to quickly find a condition when you know its name!+Let add a new blank event. Click on 'Add condition'​ and this time select the condition 'Is on floor' inside the Platformer ​behavior ​category. Note that you can use the search box on the top to quickly find a condition when you know its name!
  
 Fill the first parameter by choosing the Player object: Fill the first parameter by choosing the Player object:
Line 110: Line 110:
 In fact, it's a good opportunity to make our character displaying not only the idle and jumping but also the running animation too: In fact, it's a good opportunity to make our character displaying not only the idle and jumping but also the running animation too:
  
-We could do two events with two conditions and an action in each+We could add two eventswith two conditions and an action in each event:
  
      * When the player is on the ground *and* not running, the Idle animation must be shown.      * When the player is on the ground *and* not running, the Idle animation must be shown.
      * When the player is on the ground *and* running, the Running animation must be shown.      * When the player is on the ground *and* running, the Running animation must be shown.
  
- ​but ​we can use *sub-events* to only have the condition checking if the player on the ground one time+Instead, ​we can use *sub-events*to only have the condition checking if the player on the ground one time.
- +
-So, let do that. We can now add two other events, which will be sub-events of this event. This mean that they only will be launched when their *parent* (the event we just created) has its conditions met.+
  
 Select the event we created by clicking on an empty area near `Add condition` or `Add action`: Select the event we created by clicking on an empty area near `Add condition` or `Add action`:
Line 127: Line 125:
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.05.49.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.05.49.png?​nolink |}}
  
-Two "​child"​ events are added under the event which is considered the parent event now. There is some added margin on the left and a line between them to visually confirm that they are connected:+Two "​child"​ events are added under the event which is considered the parent event now. There is some added margin on the left of the events ​and a line between them to visually confirm that they are connected:
  
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.07.02.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.07.02.png?​nolink |}}
Line 139: Line 137:
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.09.30.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.09.30.png?​nolink |}}
  
-Our events ​should look something like this so far:+Here are our events so far: 
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.10.03.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.10.03.png?​nolink |}}
  
-We're almost done, let's finish ​it by adding the required ​action ​to each event. Use the first event to set the animation of the character to `"​Running"​` and the second event to set the animation of the character `to "​Idle"​`. You can add these actions the same way as we did before ​with jumping, don't forget the quotes " " when you enter the animation ​name.+We're almost done, let's finish by adding the required ​actions ​to each event. Use the first event to set the animation of the character to `"​Running"​` and the second event to set the animation of the character `to "​Idle"​`. ​ 
 + 
 +You can add these actions the same way we did before ​for the jumping ​animation. Don't forget the quotes ​(`" "`) when you enter the animation ​names.
  
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.15.20.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.15.20.png?​nolink |}}
Line 148: Line 149:
 ## Time to preview (and save) ## Time to preview (and save)
  
-Let preview ​the game and see that the player animation is changing while running and jumping!+You can launch a preview ​of your game and see that the player animation is changing while running and jumping!
  
-little bug you might notice if you try to jump off a platform is that the player is playing the walking ​animation ​even when falling. This is may not be something we want and prefer ​to play a falling animation instead ​when the player is falling. To fix it, we can set the animation ​to Jumping also when the player ​is falling just like we did before with the other animations. It should be not problem by now. Just add a blank event, add the condition 'Is falling'​ and add the action to change the animation by name to '​Jumping'​.+small improvement we can do is to set the animation to Jumping ​when the player is falling ​​too (otherwise ​the Running ​animation ​​keeps playing ​when the player ​​reaches ​the end of platform).
  
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.23.10.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-26_at_22.23.10.png?​nolink |}}
 ## Next step: have the camera follow the player ## Next step: have the camera follow the player
  
-For now it's hard to build a large level to explore because the player can quickly walk outside of the screen! The next part of the tutorial will show how to make the camera follow the player. It's really simple, a single event will be enough!+For nowit's hard to build a large level to explore because the player can quickly walk outside of the screen! The next part of the tutorial will show how to make the camera follow the player. It's really simple, a single event will be enough!
  
 ➡️ Read **[[gdevelop5:​tutorials:​platform-game:​3-have-camera-follow-player|the next part of the tutorial here]]**! ​ ➡️ Read **[[gdevelop5:​tutorials:​platform-game:​3-have-camera-follow-player|the next part of the tutorial here]]**! ​