# Differences

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

Both sides previous revision Previous revision Next revision | Previous revision | ||

gdevelop:documentation:manual:pres_concepts [2016/04/12 18:04] zat Correct link |
gdevelop:documentation:manual:pres_concepts [2020/05/31 11:37] (current) rapperdinesh [And that's almost all you need to know] |
||
---|---|---|---|

Line 1: | Line 1: | ||

====== Concepts ====== | ====== Concepts ====== | ||

- | The basic concepts of GDevelop are simple. Read the following information to get started with the program. | + | The basic concepts of GDevelop are simple. Read the following information to get started. |

===== Coordinate system ===== | ===== Coordinate system ===== | ||

Line 19: | Line 19: | ||

{{wiki:pres_coord2.png}} | {{wiki:pres_coord2.png}} | ||

- | If you use trigonometric functions like the **sine** or the **cosine**, note that you will have to express angles in **radians**. ( 1 radian = 180/PI degrees and 1 degree = PI/180 radians, PI being the number which is approximately equal to 3.14159 ) | + | If you use trigonometric functions like the **sine** or the **cosine**, note that you will have to express angles in **radians**. ( 1 radian = 180/PI degrees and 1 degree = PI/180 radians, PI is the number which is approximately equal to 3.14159 ) |

---- | ---- | ||

Line 45: | Line 45: | ||

{{wiki:pres_event4.png}} | {{wiki:pres_event4.png}} | ||

- | The first pair creates a "Square" object in position 200;100 and then deletes it. **No** "Square" is displayed on screen.\\ | + | The first pair creates a "Square" object in position 200;100 and then deletes it. **No** "Square" is displayed on the screen.\\ |

The second pair deletes all "Square" objects from the scene, and then creates one "Square" in position 200;100, so the square remains **visible**. | The second pair deletes all "Square" objects from the scene, and then creates one "Square" in position 200;100, so the square remains **visible**. | ||

Line 53: | Line 53: | ||

Moving objects can be achieved thanks to **forces**, which are used to "pull" objects. | Moving objects can be achieved thanks to **forces**, which are used to "pull" objects. | ||

- | You can specify the Cartesian coordinates of a force (i.e. X and Y, in pixels), its polar coordinates (the force vector angle and length), and the **force dispersion**, a coefficient between 0 and 1. Each second, the force length will be multiplied by the dispersion: a value of 1 means that force will continue forever, a value of 0 will make it stop immediately. All intermediate values will cause the force to gradually stop. | + | You can specify the Cartesian coordinates of a force (i.e. X and Y, in pixels), its polar coordinates (the force vector angle and length), and the **force dispersion**, a coefficient between 0 and 1. Each second, the force-length will be multiplied by the dispersion: a value of 1 means that force will continue forever, a value of 0 will make it stop immediately. All intermediate values will cause the force to gradually stop. |

==== Example ==== | ==== Example ==== | ||

Line 70: | Line 70: | ||

===== Variables ===== | ===== Variables ===== | ||

- | Variables allow you to store **data**, for example a number or a text. We might compare them to drawers or boxes where we can file notes. Any data can be stored, as long as it is in //text// or //number// format: number of lives remaining, high-score, bullets left, killed enemies, etc... You are probably going to use numbers often. | + | Variables allow you to store **data**, for example, a number or a text. We might compare them to drawers or boxes where we can file notes. Any data can be stored, as long as it is in //text// or //number// format: number of lives remaining, high-score, bullets left, killed enemies, etc... You are probably going to use numbers often. |

{{wiki:pres_variable.png}} | {{wiki:pres_variable.png}} | ||

Line 88: | Line 88: | ||

===== Time elapsed since last frame (TimeDelta) ===== | ===== Time elapsed since last frame (TimeDelta) ===== | ||

- | The game evaluates events and repaints the screen several times per second: we say that the game is //refreshed//. How often this happens depends on your computer resources: a slow computer can render 25 frames per second, a fast one 140. 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//. How often this happens depends on your computer resources: a slow computer can render 25 frames per second, a fast one 140. 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() expression, which returns the time in seconds since the last frame. | ||

Line 99: | Line 99: | ||

{{wiki:pres_event6.png}} | {{wiki:pres_event6.png}} | ||

- | The first event is adding 20 to the variable every time the game is refreshed ( i.e. as much as possible ). It's **not correct** to use a 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.\\ | + | The first event is adding 20 to the variable every time the game is refreshed ( i.e. as much as possible ). 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.\\ |

- | 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 unit/seconds. Thus, we can predicate that the life will increase by 3000 units in 10 seconds. | + | 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/seconds. Thus, we can predicate that life will increase by 3000 units in 10 seconds. |

Remember to use TimeDelta when you want to continually add some amount to a value.\\ | Remember to use TimeDelta when you want to continually add some amount to a value.\\ | ||

Line 108: | Line 108: | ||

===== And that's almost all you need to know ===== | ===== And that's almost all you need to know ===== | ||

- | You can continue to read the [[gdevelop:documentation:manual:edit_getstart|Getting Started page]] to see an overview of GDevelop interface. | + | You can continue to read the [[gdevelop:documentation:manual:edit_getstart|Getting Started page]] to see an overview of the GDevelop interface. |