### How do I create X chances or success to end game?

#### dazedangels

• Posts: 20
I'm stumped because I don't know what to search for.

The goal of level 1 is to shoot 8 balloons, you have 10 projectiles to do it, which ever comes first ends the game.
I think that needs a screen behavior, but I don't know which Event to add.
My brains just wants to right 'while' & 'if' statements, it's not thinking in blocks yet.

I have an event for if 8 balloons are shoot to end the game, but can't figure how to end the game if 8 balloons aren't killed, but the 10 projectiles are used.

Any hints?
Or can you tell me what I should be searching for?
Thank you

« Last Edit: May 16, 2019, 10:06:22 am by dazedangels »

• Posts: 1780
Well..you could split the logic...
- When you shoot the projectiles check if there are any left, and if not then it's game over (more or less...you still need to check if the last projectile reached a balloon).
- In a scene event check when a balloon is killed, and if 8 of them got killed...then it's game over.

That's just one way to achieve what you want.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

#### JeffreyDriver

• Posts: 2104
Have two number attributes.  One called 'projectiles', one called 'balloons'

Then for each balloon, increment 'balloons' by 1. As balloons are killed and projectiles are used decrement the correct attribute, then if either equal 0, end the level.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

#### dazedangels

• Posts: 20
Next question. I'm assuming you mean game attributes (made in settings)
Each level will have a different amount of each balloon that has to be killed - For example. Level 1 will need to shoot 8 balloons with 10 blasts, but level 6 will need to shoot 4 yellow, 4 green and 4 red balloons with 14 shots - Will I need to make an attribute for each lever for each balloon?
If I am creating a mobile game and have 600 levels will that work? Is that how it's supposed to work?

#### dazedangels

• Posts: 20
Oh I guess I could make local attributes for each level, but wouldn't I have the same problem when I get to level 600?

#### JeffreyDriver

• Posts: 2104
Yes, local attributes. If you're going to have different colour balloons then things will get a little more complex, but the idea is the same. You'd need to run the check after the projectile has been fired (e.g. has it stopped moving or left the screen)
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

#### dazedangels

• Posts: 20
1. I know right now you're rolling your eyes - hard, but in a year I'll be a master at this - unfortunately until then .... I will be asking every stupid question .... some times twice.

2.  I pretty sure these blocks will work (at the bottom), but I don't know what kind of Event to put it in.
I know I can't add it to that event, but what event do I need to use, please?

Thank you.

#### Biiiscoito

• Posts: 21
Working with behaviors would be best if you are planning on using the same logic on a lot of levels.
I learned this the painful way. Takes a while to get the gist of it, but it's soooo handy.
The print from the last post -- the code you pointed by the arrow could be on an "always" or "when updating" event.
Also, instead of enabling a game over behavior, you could create a custom event called "gave over", and, "if yBlasts<1 then trigger event game over on this scene".