Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:tutorials:platform-game:5-add-coins-and-number-of-collected-coins [2018/09/13 23:39]
4ian [Bonus: fixing the score bug]
gdevelop5:tutorials:platform-game:5-add-coins-and-number-of-collected-coins [2019/12/27 10:50] (current)
4ian [Bonus: making sure that collecting two coins at the same time works]
Line 164: Line 164:
 To start, click the + button in the toolbar of the Events Editor: To start, click the + button in the toolbar of the Events Editor:
  
-{{ :​gdevelop5:​tutorials:​platform-game:​gdevelop_5_2018-05-30_11-30-39.png?200 |}}+{{ :​gdevelop5:​tutorials:​platform-game:​gdevelop_5_2018-05-30_11-30-39.png |}}
  
 Select "for each object":​ Select "for each object":​
  
-{{ :​gdevelop5:​tutorials:​platform-game:​2018-05-30_11-33-09.png?400 |}}+{{ :​gdevelop5:​tutorials:​platform-game:​2018-05-30_11-33-09.png |}}
  
 This will add an event at the bottom of the event page. Drag it up and make it a sub-event of the player collision with the coin:  This will add an event at the bottom of the event page. Drag it up and make it a sub-event of the player collision with the coin: 
  
-{{ :​gdevelop5:​tutorials:​platform-game:​click-to-choose-4.png?600 |}}+{{ :​gdevelop5:​tutorials:​platform-game:​click-to-choose-4.png |}}
  
 Click to choose an object, and choose the Coin object. Click to choose an object, and choose the Coin object.
  
-{{ :​gdevelop5:​tutorials:​platform-game:​click-to-choose2.png?600 |}}+{{ :​gdevelop5:​tutorials:​platform-game:​click-to-choose2.png |}}
  
 Now that you've added the object to the sub-event, let's move the actions down to the sub-event (so that the actions will be repeated for each coin that is picked by conditions). ​ Now that you've added the object to the sub-event, let's move the actions down to the sub-event (so that the actions will be repeated for each coin that is picked by conditions). ​
Line 182: Line 182:
 Hover over the first action, right-click and cut it, then hover over the action in the sub-event, right-click,​ and paste. Do this for the other two actions. You can also drag'​n'​drop actions, which is faster than cut-pasting them. Hover over the first action, right-click and cut it, then hover over the action in the sub-event, right-click,​ and paste. Do this for the other two actions. You can also drag'​n'​drop actions, which is faster than cut-pasting them.
  
-{{ :​gdevelop5:​tutorials:​platform-game:​move-to-sub1.png?600 |}}+{{ :​gdevelop5:​tutorials:​platform-game:​move-to-sub1.png |}}
  
 This is what the final event should look like:  This is what the final event should look like: 
  
-{{ :​gdevelop5:​tutorials:​platform-game:​move-to-sub2.png?600 |}}+{{ :​gdevelop5:​tutorials:​platform-game:​move-to-sub2.png |}}
  
 Now run the game, and you will see that if you gather two coins at the same time, the score will be updated properly if you run on two coins at the exact same time. Now run the game, and you will see that if you gather two coins at the same time, the score will be updated properly if you run on two coins at the exact same time.
 +
 +<​note>​You can check the proper working of this by putting two coins at the same position in the scene.</​note>​
 +
  
 ## Next step: add enemies ## Next step: add enemies