Problem 8

You have to hit a character 3 times with a bullet before it dies.

Load up your problem 4 game.

Make and enemy sprite, amd then an object. Click on the create event. Drag set the number of lives, under the score tab, into the action section. When the popup appears, type 3 in the new lives section. Click ok. Click on the already made collision with bullet event. Drag set the nuber of lives, under the score tab, into the action section. When the popup appears, type in -1 in the new lives section. Click the relative box, then ok. Delete the change instance into explosion.

Click on add event, Step. Drag If lives are a value, under the score tab, into the action section. When the popup appears, type 0 in the value section, and select equals to in the operation section. Then drag both start of block and end of block, under the control tab, into the action section. In between these, drag change the instance, under the main1 tab. When the popup appears, select object explode in the change into section, and yes in the perform events section.

Test the game, to see if the enemy will explode after 3 bullets.

i got this workin easy but couldn’t think of a way to get rid of the bullet after the third hit (so it looks a bit shotty, even though getting rid of the bullet isn’t a requirement)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.