Smog Cloud Madness

n this game the factories on the ground create the smog. Every few seconds the factories release a deadly smog cloud in to the sky. Now that you have created your smog object you want to create the factory object to release the smog.

First, create a sprite and object named factory using the factory image file included in the resources.

Inside this object, click the add event button. When the event selector window appears, select alarm and then alarm0 from the drop-down menu. You'll see the event you selected appear in the events column of the object properties window.

From the main1 tab at the right of the object properties window, drag the create instance action into the actions column. When the create instance settings window appears, click the context menu and select the smog object from the drop-down menu. Then change x from 0 to self.x and y from 0 to self.y.

Click ok to save the settings to the action. You'll see the object you selected appear in the actions column.

WHY DID I DO THAT?

Sometimes we want something to happen at an objects location, but in a game a lot can be happening at once. So we use a special word called self. Anytime we use this, we are referring to the object itself. In this case, we use the x and y coordinates of the factory as the starting point of the smog cloud

From the main2 tab at the right of the object properties window, drag the set alarm action to the actions column. When the set alarm settings window appears, change the number of steps from 0 to 75. Then check to see that in alarm no is set to alarm0. If it is not, click the context menu and select alarm0.

Click ok to save the settings to the set alarm action. You'll see the action appear in the actions column.

Click the add event button. When the event selector window appears, select create event. You'll see the event you selected appear in the events column of the object properties window.

From the main2 tab at the right of the object properties window, drag the set alarm action to the actions column. When the set alarm settings window appears, change the number of steps from 0 to 75. Then check to see that in alarm no is set to alarm0. If it is not, click the context menu and select alarm0.

Click ok to save the settings to the set alarm action. You'll see the action appear in the actions column.

Double-click the room you created earlier in your room folder. When the room properties window appears, your factory object should appear in the object tab. If it is not there, click the context menu and select the factory object from the drop-down menu. Place one factory in the room.

Click the green checkmark button to save the changes to the room, then test your game.