Differences

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

Link to this comparison view

Both sides previous revision Previous revision
gdevelop5:events:js-code [2019/05/19 16:32]
piyushpalawat99
gdevelop5:events:js-code [2019/06/13 21:27] (current)
piyushpalawat99
Line 5: Line 5:
 To add a JavaScript event, click on the + button in the Events Sheet toolbar, and select JavaScript code: To add a JavaScript event, click on the + button in the Events Sheet toolbar, and select JavaScript code:
  
-{{ :​gdevelop5:​events:​insert-javascript-code-event.png?nolink&​600 ​|}}+{{ :​gdevelop5:​events:​insert-javascript-code-eventnew.png?nolink |}}
  
 When added, click on the code to edit it. The code will be executed each time the event is reached by GDevelop. When added, click on the code to edit it. The code will be executed each time the event is reached by GDevelop.
Line 15: Line 15:
 If you click on "Click here to choose objects to pass to Javascript"​ next to the runtimeScene parameter, an array variable called "​objects"​ will be available to use. A menu of your game objects will pop up. You can select the game object of our choice. That object will be added to your javascript object array. If you click on "Click here to choose objects to pass to Javascript"​ next to the runtimeScene parameter, an array variable called "​objects"​ will be available to use. A menu of your game objects will pop up. You can select the game object of our choice. That object will be added to your javascript object array.
  
-{{:​gdevelop5:​events:​jsruntimeclickevent.png?600|}}+{{:​gdevelop5:​events:​jsruntimeclickeventnew.png?|}}
  
 "​objects"​ is an array that contains the selected instances of the object that you choose. It is exactly like what an action or a condition would use). For example, the illustration below is an event using a JavaScript event as a sub-event. The javascript event will manipulate the enemies that are colliding with the player: "​objects"​ is an array that contains the selected instances of the object that you choose. It is exactly like what an action or a condition would use). For example, the illustration below is an event using a JavaScript event as a sub-event. The javascript event will manipulate the enemies that are colliding with the player: