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:events [2018/12/23 00:18]
4ian
gdevelop5:events [2019/08/16 07:27] (current)
4ian
Line 1: Line 1:
 # Events # Events
 {{ :​gdevelop5:​event-screenshot.png?​nolink |}} {{ :​gdevelop5:​event-screenshot.png?​nolink |}}
-Events in GDevelop allow you to visually program ​your game without ​any prior programming knowledge ​or experience, so anyone with any background will be able to create the actual gameplay and allow players to interact with the game+Events in GDevelop allow you to create the logic that is running ​your game. Events are readable by anyone and can be authored ​without ​advanced ​programming knowledge.
  
 Even for experienced programmers,​ events are fast to write and read. They allow artists, designers, level designers and anyone working on the game to understand and update the rules of the game. Even for experienced programmers,​ events are fast to write and read. They allow artists, designers, level designers and anyone working on the game to understand and update the rules of the game.
Line 7: Line 7:
 ==== Event types ==== ==== Event types ====
  
-There are different ​type of events in GDevelop ​that can be used for different purposes+There are different ​types of events in GDevelop: 
-  * [[gdevelop5:​events:​standard|Standard event]]: this event is the default one and is triggered every single frame. It executes the actions once the conditions are true, then move on to the next event.+  * [[gdevelop5:​events:​standard|Standard event]]: this event is the default one and is triggered every single frame. It executes the actions once the conditions are true, then moves on to the next event.
   * [[gdevelop5:​events:​foreach|For Each event]]: this event is triggered for each and every instance of the selected object, ​ checks the conditions, and then executes the actions for each individually before moving to the next event.   * [[gdevelop5:​events:​foreach|For Each event]]: this event is triggered for each and every instance of the selected object, ​ checks the conditions, and then executes the actions for each individually before moving to the next event.
   * [[gdevelop5:​events:​repeat|Repeat event]]: this event is repeated the specified number of times before moving on to the next event.   * [[gdevelop5:​events:​repeat|Repeat event]]: this event is repeated the specified number of times before moving on to the next event.
-  * [[gdevelop5:​events:​while|While event]]: this event  is repeated continuously while the specified conditions are met and moves on to the next event only after the conditions of this event are no longer true. +  * [[gdevelop5:​events:​while|While event]]: this event is repeated continuously while the specified conditions are met and moves on to the next event only after the conditions of this event are no longer true. 
   * Comments: these events are used to add comments or explanations into an event sheet - they won't change anything during the game.    * Comments: these events are used to add comments or explanations into an event sheet - they won't change anything during the game. 
   * [[gdevelop5:​events:​link|Link]]:​ This event allows you to call the specified external event. External events are events that are not linked to a specified scene. You can call and execute them from one or more scenes using Link events.   * [[gdevelop5:​events:​link|Link]]:​ This event allows you to call the specified external event. External events are events that are not linked to a specified scene. You can call and execute them from one or more scenes using Link events.
Line 17: Line 17:
   * [[gdevelop5:​events:​js-code|JavaScript event]]: this event allows you to use JavaScript code along with other events   * [[gdevelop5:​events:​js-code|JavaScript event]]: this event allows you to use JavaScript code along with other events
  
-Events can have **sub-events** (except for Links, Comments and JavaScript code). Sub-events are triggered only after the parent event'​s actions ​has been executed. If the conditions of the parent event are false, then no sub-event is executed.+Events can have **sub-events** (except for Links, Comments and JavaScript code). Sub-events are triggered only after the parent event'​s actions ​have been executed. If the conditions of the parent event are false, then no sub-event is executed.
  
 Finally, advanced users can create their own actions and conditions using [[gdevelop5:​events:​functions|functions]]. It's a way to make your events even more modular and adapted to your game. Finally, advanced users can create their own actions and conditions using [[gdevelop5:​events:​functions|functions]]. It's a way to make your events even more modular and adapted to your game.
  
 ==== Add events ==== ==== Add events ====
-In order to add events to our game, first we need to switch to the event editor. We can do that using the event tab next to our scene tab.+In order to add events to our game, firstwe need to switch to the event editor. We can do that using the event tab next to our scene tab.
 {{ :​gdevelop5:​objects:​events-tab.png?​nolink |}}  {{ :​gdevelop5:​objects:​events-tab.png?​nolink |}} 
  
Line 30: Line 30:
 To add standard event we can use the add event button To add standard event we can use the add event button
 {{ :​gdevelop5:​add-event-button.png?​nolink |}} {{ :​gdevelop5:​add-event-button.png?​nolink |}}
-To add sub events, first we need to select an event in the editor and after click the add sub-event button+To add sub-events, firstwe need to select an event in the editor and later, ​click the add sub-event button.
 {{ :​gdevelop5:​sub-event-button.png?​nolink |}} {{ :​gdevelop5:​sub-event-button.png?​nolink |}}
-You can find all the available options by clicking the plus icon+You can find all the available options by clicking the plus icon.
 {{ :​gdevelop5:​add-special-events.png?​nolink |}} {{ :​gdevelop5:​add-special-events.png?​nolink |}}
  
 ==== Add conditions and actions ==== ==== Add conditions and actions ====
-When an event is added in the editor, it is blank (no conditions and no actions):+An event comprises of conditions and actions. When the specified condition(s) are met, the corresponding action(s) take place. ​When an event is added in the editor, it is blank (no conditions and no actions):
 {{ :​gdevelop5:​blank-event.png?​nolink |}} {{ :​gdevelop5:​blank-event.png?​nolink |}}
  
 We can add any number of conditions and actions to each event. ​ We can add any number of conditions and actions to each event. ​
  
-To add conditions and actions we need to click add condition and add action inside the event, then we can choose from many options sorted in to different categories.+To add conditions and actionswe need to click add condition and add action inside the event respectively, then we can choose from a number of optionssorted in different categories.
  
-In order to learn more about how to use the different conditions and actions, we recommend ​to read [[gdevelop5:​tutorials|the tutorials and guides available on the wiki]]. ​+In order to learn more about how to use the different conditions and actions, we recommend ​reading ​[[gdevelop5:​tutorials|the tutorials and guides available on the wiki]]. ​
  
 You can also create your own conditions and actions using [[gdevelop5:​events:​functions|functions]]. You can also create your own conditions and actions using [[gdevelop5:​events:​functions|functions]].
 +
 +==== Move events ====
 +Unlike copying, when you move an event, its position is changed rather than being duplicated to a new position. This can be done by right-clicking on the event to be moved and selecting the "​Cut"​ option. This will remove the event from the events sheet.
 +
 +To paste the event, right-click on the event above which your event should be pasted and select the "​Paste"​ option.
 +
 +{{ :​gdevelop5:​event_cut_paste.gif?​nolink |}}
 +
 +Another way to move an event is by simply drag-and-dropping the blue bar on the left side of the event in the vertical direction.
 +
 +{{ :​gdevelop5:​drag_n_drop.gif?​nolink |}}
 +
 +This method also allows you to move a standard event as a sub-event. For this, drag-and-drop the event below the desired parent event of your sub-event and move the event to the right side.
 +
 +{{ :​gdevelop5:​drag_n_drop_subevent.gif?​nolink |}}
 +
 +==== Move conditions/​actions ====
 +You can move conditions/​actions such that they are removed from the event they were originally in, and moved to the event they are desired to be in.
 +
 +You can move a condition/​action by right-clicking on it, and then choosing the "​Cut"​ option. To paste it, right click on the "Add condition"​ or "Add action"​ option in the desired event and choose the "​Paste"​ option.
 +
 +{{ :​gdevelop5:​action_cut_paste.gif?​nolink |}}
 +
 +<​note>​Some features might be supported both, as a condition as well as an action. For example, "Pick a random object"​ or "Pick all objects"​ are present as a condition as well as an action.</​note>​
 +
 +You can also move the condition/​action by drag-and-dropping it from the current event to the desired event. While drag-and-dropping,​ the new position of the condition/​action will be denoted using a black bar in the events editor.
 +
 +{{ :​gdevelop5:​action_drag_and_drop.gif?​nolink |}}
 +
 +==== Search/​Replace in the event editor ====
 +Sometimes, searching for an event in the event sheet can be cumbersome. For this, you can use the search feature. To search within the event sheet, you can either click on the "​Search in events"​ button {{:​gdevelop5:​search-button.png?​nolink|}} or press Ctrl + F.
 +
 +To search for a keyword, enter the keyword in the search bar at the bottom of the window and click on "​Search"​.
 +
 +{{ :​gdevelop5:​annotation_2019-06-21_145733.png?​nolink |}}
 +
 +You will see the total number of matches at the bottom of the bar. To switch between the results, use the arrow keys beside the number of results.
 +
 +If you want the search to be case sensitive, untick the "Case insensitive"​ option.
 +
 +{{ :​gdevelop5:​annotation_2019-06-21_154609.png?​nolink |}}
 +
 +You can also filter the search results to either search only within actions or conditions or both.
 +
 +{{ :​gdevelop5:​annotation_2019-06-21_154925.png?​nolink |}}
 +
 +To replace the instances of a text with another text, enter the text to be replaced in the "Text to search"​ field and in the "Text to replace"​ field, enter the new text. Clicking on the "​Replace"​ button will replace all the instances of the text in the search field.
 +
 +{{ :​gdevelop5:​annotation_2019-06-21_160842.png?​nolink |}}