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
Last revision Both sides next revision
gdevelop5:tutorials:basic-game-making-concepts [2018/10/13 03:50]
valiant_curiosity [Other ways of moving objects]
gdevelop5:tutorials:basic-game-making-concepts [2019/07/08 14:28]
piyushpalawat99 [Common conditions/actions for all objects]
Line 5: Line 5:
 ## Coordinates ## Coordinates
  
-Objects on the GDevelop screen/​scene have an X and coordinate. These coordinates correspond to the horizontal position (X-axis) and the vertical position (Y-axis) on the //Cartesian plane//.+Objects on the GDevelop screen/​scene have  X and  coordinates. These coordinates correspond to the horizontal position (X-axis) and the vertical position (Y-axis) on the //Cartesian plane//.
  
-The X-coordinate //​decreases//​ as you scroll ​to the left and //​increases//​ as you scroll ​to the right. The Y-coordinate //decreases// as you scroll upwards ​and //increases// as you scroll downwards.+The X-coordinate //​decreases//​ as you go to the left and //​increases//​ as you go to the right. The Y-coordinate //increases// as you go down and //decreases// as you go up.
  
 {{ wiki:​pres_coord1.png }} {{ wiki:​pres_coord1.png }}
Line 36: Line 36:
 <note tip>​**See it in action!** 🎮Open this example online: https://​editor.gdevelop-app.com/?​project=example://​object-selection</​note>​ <note tip>​**See it in action!** 🎮Open this example online: https://​editor.gdevelop-app.com/?​project=example://​object-selection</​note>​
  
-[[https://​editor.gdevelop-app.com/?​project=example://​object-selection|{{ :​gdevelop5:​tutorials:​objectselection-pickobject.png?400 |}}]]+[[https://​editor.gdevelop-app.com/?​project=example://​object-selection|{{ :​gdevelop5:​tutorials:​objectselection-pickobject.png |}}]]
  
 ## Events: the order is important ## Events: the order is important
Line 48: Line 48:
 {{ :​gdevelop5:​tutorials:​delete-then-create-square.png?​nolink |}} {{ :​gdevelop5:​tutorials:​delete-then-create-square.png?​nolink |}}
  
-* The first pair of events actions ​creates ​a "​Square"​ object at coordinates X: 100. Y: 200 (100;200). Then the event deletes the created square immediately. **No** "​Square"​ is displayed on the screen. It's deleted just after being created. +* The first pair of events actions ​create ​a "​Square"​ object at coordinates X: 100. Y: 200 (100;200). Then the event deletes the created square immediately. **No** "​Square"​ is displayed on the screen. It's deleted just after being created. 
-* The second pair of events actions deletes all of the "​Square"​ objects from the scene/​screen. It then creates one "​Square"​ at the scene/​screen coordinates X: 100, Y: 200 (100;​200). ​ This event shows a  square is  **visible** on the scene (before being deleted at the next frame. It will, then, be recreated immediately.+* The second pair of events actions deletes all the "​Square"​ objects from the scene/​screen. It then creates one "​Square"​ at the scene/​screen coordinates X: 100, Y: 200 (100;​200). ​ This event shows a  square is  **visible** on the scene (before being deleted at the next frame. It will, then, be recreated immediately.
  
 ## Moving objects using built-in forces ## Moving objects using built-in forces
Line 78: Line 78:
 <note tip>​**See it in action!** 🎮Open this example online: https://​editor.gdevelop-app.com/?​project=example://​move-object-with-physics</​note>​ <note tip>​**See it in action!** 🎮Open this example online: https://​editor.gdevelop-app.com/?​project=example://​move-object-with-physics</​note>​
  
-[[https://​editor.gdevelop-app.com/?​project=example://​move-object-with-physics|{{ :​gdevelop5:​tutorials:​moveobjectwithphysics.png?400 |}}]]+[[https://​editor.gdevelop-app.com/?​project=example://​move-object-with-physics|{{ :​gdevelop5:​tutorials:​moveobjectwithphysics.png |}}]]
  
  
Line 84: Line 84:
 ## Variables ## Variables
  
-Variables allow you to store **data**. ​ For example, a variable can store a number or a text. We might compare them to drawers or boxes where we can file notes. Any data can be stored in a variable, as long as it is in //text// or //number// format. Such things as the number of lives a player has remaining, a player'​s high-score, the number of bullets left, and/or the number of enemies killed are all examples of what can be stored in a variable. You are probably going to store numbers in variables as a common practice.+A Variable allows ​you to store **data**. ​ For example, a variable can store a number or a text. We might compare them to drawers or boxes where we can file notes. Any data can be stored in a variable, as long as it is in //text// or //number// format. Such things as the number of lives a player has remaining, a player'​s high score, the number of bullets left, and/or the number of enemies killed are all examples of what can be stored in a variable. You are probably going to store numbers in variables as a common practice.
  
 {{ wiki:​pres_variable.png }} {{ wiki:​pres_variable.png }}
Line 95: Line 95:
  
 * **Global** variables are accessible from all the game scenes. For instance, they can be used to store the player'​s score across different levels/​scenes. * **Global** variables are accessible from all the game scenes. For instance, they can be used to store the player'​s score across different levels/​scenes.
-* **Scene** variables are only accessible from the scene they are  created in. They can be used for data that only concerns one scene. ​ A Scene variable would be able to access the time remaining to complete the level/​scene.\\+* **Scene** variables are only accessible from the scene they are created in. They can be used for data that only concerns one scene. ​ A Scene variable would be able to access the time remaining to complete the level/​scene.\\
 * **Object** variables only concern one object. For example, a hero can have a "​Health"​ or "​Ammo"​ variable. * **Object** variables only concern one object. For example, a hero can have a "​Health"​ or "​Ammo"​ variable.
  
Line 116: Line 116:
 * The first event is adding 20 to the variable every time the game is refreshed (i.e. as much as possible, up to 60 times per second). It's **not correct** to use such event as the speed of the increase of the variable will not be the same from computer to computer: we cannot predict the value of the variable after 10 seconds for example - as it depends on the number of frames of the game painted. * The first event is adding 20 to the variable every time the game is refreshed (i.e. as much as possible, up to 60 times per second). It's **not correct** to use such event as the speed of the increase of the variable will not be the same from computer to computer: we cannot predict the value of the variable after 10 seconds for example - as it depends on the number of frames of the game painted.
  
-* The second event is **correct and reliable** : The number 300 is multiplied by TimeDelta(). Thus, the variable will be increased at the same time on all computers. As  TimeDelta() returns a time in second, it allows you to quantify exactly the amount: In our case, the variable will grow at 300 units/​second. Thus, we can predicate that the life will increase by 3000 units in 10 seconds - whatever the number of frames painted during this time.+* The second event is **correct and reliable** : The number 300 is multiplied by TimeDelta(). Thus, the variable will be increased at the same time on all computers. As  TimeDelta() returns a time in second, it allows you to quantify exactly the amount: In our case, the variable will grow at 300 units/​second. Thus, we can predicate that life will increase by 3000 units in 10 seconds - whatever the number of frames painted during this time.
  
 **Remember:​** ​ Use //​TimeDelta() // when you want to continually add some amount to a value. If your action is meant to be launched only once (for example, during a collision where you then delete the object), it's ok to use a discrete value without TimeDelta - as it does not depend upon the speed of the game. **Remember:​** ​ Use //​TimeDelta() // when you want to continually add some amount to a value. If your action is meant to be launched only once (for example, during a collision where you then delete the object), it's ok to use a discrete value without TimeDelta - as it does not depend upon the speed of the game.
  
 <note warning>​When you're moving an object using forces, there is no need to use TimeDelta() as GDevelop automatically uses it.</​note>​ <note warning>​When you're moving an object using forces, there is no need to use TimeDelta() as GDevelop automatically uses it.</​note>​
 +
 +##Common conditions/​actions for all objects
 +
 +Every object has common conditions/​actions,​ **[[gdevelop5:​tutorials:​basic-game-making-concepts:​events|read more about them here]]**.
  
 ## And... that's almost all you need to know ## And... that's almost all you need to know