Differences

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

Link to this comparison view

Both sides previous revision Previous revision
gdevelop:tutorials:beginnertutorial2 [2019/05/28 19:24]
tany13 [Deleting the bullets going out of the screen]
gdevelop:tutorials:beginnertutorial2 [2019/05/28 19:25] (current)
tany13 [Deleting the bullets going out of the screen]
Line 289: Line 289:
 ===== Deleting the bullets going out of the screen ===== ===== Deleting the bullets going out of the screen =====
  
-It is a must to destroy our garbage so as to prevent the game being flooded with tons of useless objects, which slow it down. That's why we take care of deleting the explosions when the animations is over. But what about the bullets? When they go outside of the screen, they still exists ​and the computer must update them each time the screen is refreshed: This can lead to a performance bottleneck.+It is a must to destroy our garbage so as to prevent the game being flooded with tons of useless objects, which slow it down. That's why we take care of deleting the explosions when the animations is over. But what about the bullets? When they go outside of the screen, they still exist and the computer must update them each time the screen is refreshed: This can lead to a performance bottleneck.
  
 We could add an event to destroy the bullets when they are too far from the turret- that is quite easy. But we can also use a //​behavior//:​ A //​behavior//​ is used to add a specific behavior to an object. Here, we are going to use a behavior that will automatically destroy the object when it goes outside the screen. We could add an event to destroy the bullets when they are too far from the turret- that is quite easy. But we can also use a //​behavior//:​ A //​behavior//​ is used to add a specific behavior to an object. Here, we are going to use a behavior that will automatically destroy the object when it goes outside the screen.