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:basic-game-making-concepts [2021/01/17 22:46]
mannhb [Behaviors: pre-defined rules and logic for objects]
gdevelop5:tutorials:basic-game-making-concepts [2021/05/07 00:49] (current)
silver-streak [An advanced notion: the "time elapsed" since last frame (TimeDelta)]
Line 48: Line 48:
 ## Events: the order is important ## Events: the order is important
  
-The order of events **does matter**!+The order of [[gdevelop5:events|events]] **does matter**!
  
 Events at the top are executed first. Events are executed every time your game is displayed. This display is called a frame. It executes about 60 times per second. The following examples are **not** equivalent: Events at the top are executed first. Events are executed every time your game is displayed. This display is called a frame. It executes about 60 times per second. The following examples are **not** equivalent:
Line 58: Line 58:
 * 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 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 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.
 +
  
 ## Behaviors: pre-defined rules and logic for objects ## Behaviors: pre-defined rules and logic for objects
Line 123: Line 124:
 The game evaluates events and repaints the screen several times per second: we say that the game is //refreshed//, //updated// during a "tick". How often this happens depends on your computer resources: a slow computer can render 25 frames per second, a fast one 60. GDevelop can usually make sure that this value is the same on all computers. However, the speed of some operations can change from computer to computer, for example, mathematical operations and the rendering of movements. The game evaluates events and repaints the screen several times per second: we say that the game is //refreshed//, //updated// during a "tick". How often this happens depends on your computer resources: a slow computer can render 25 frames per second, a fast one 60. GDevelop can usually make sure that this value is the same on all computers. However, the speed of some operations can change from computer to computer, for example, mathematical operations and the rendering of movements.
  
-To make the speed of changes constant, use the //`TimeDelta()` expression//, which returns the time in seconds since the last frame.+To make the speed of changes constant, use the //`TimeDelta()` [[gdevelop5:all-features:expressions|expression]]//, which returns the time in seconds since the last frame.
 For example, don't do this: For example, don't do this: