HELP!!!

Get help using Construct 2

Post » Sun Jun 30, 2013 7:04 pm

I am currently working on a platform game where the player is required to pick up a series of keys to unlock the door before being allowed to the next level.

As there are multiple keys to collect, how would I be able to check whether all the keys have been collected?

I first though I could use a Boolean variable to check, but I'm not sure how to do it, or whether that is the correct way of doing it.

Any help would be greatly appreciated. RG1102013-06-30 22:02:26
B
3
Posts: 8
Reputation: 193

Post » Sun Jun 30, 2013 10:59 pm

@RG110

Add a variable and set it to the total amount of keys, then decrease it every time you pick one up.
B
51
S
16
G
9
Posts: 1,098
Reputation: 11,252

Post » Mon Jul 01, 2013 8:51 am

@spongehammer

I did think of that as an idea, but as I am going to have multiple levels with different amounts of keys, is there not a more dynamic way of doing it?
B
3
Posts: 8
Reputation: 193

Post » Mon Jul 01, 2013 8:56 am

Put this in the layout event sheet:
System: On start of layout -> System: Set TotalKeys to Keys.Count

It'll automatically set the total keys the player needs to collect to the number of keys.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Mon Jul 01, 2013 9:09 am

@GeometriX

Thank you so much, this is exactly what I was looking for...

Thank you very much sir.
B
3
Posts: 8
Reputation: 193

Post » Mon Jul 01, 2013 9:16 am

@GeometriX

currently when the player has picked up all of the keys and stands over the door object, it enables them to go to the next level.

Currently I am doing the following: Player: Is overlapping door & Keys = 0 -> System: Go to Layout 2

Is there a more dynamic way of doing this.. I want the logic for all the levels to be kept to one event sheet if possible.
B
3
Posts: 8
Reputation: 193

Post » Mon Jul 01, 2013 9:22 am

System: Go to Layout int(layoutName)+1

This assumes your layouts are named 1, 2, 3 etc.
You could also have another variable called 'LevelNumber', increment it by 1 at start of layout and when going to next level use:

System: Go to Layout LevelNumber+1
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Mon Jul 01, 2013 9:27 am

@Vee41

Currently when I try and use any of those actions there is nowhere I can enter anything, Just a dropdown menu....
B
3
Posts: 8
Reputation: 193

Post » Mon Jul 01, 2013 9:47 am

[QUOTE=RG110] @Vee41

Currently when I try and use any of those actions there is nowhere I can enter anything, Just a dropdown menu....[/QUOTE]

Use Go to Layout(by name) - action. It's in the system events.
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Mon Jul 01, 2013 1:00 pm

@Vee41

Thanks for your help, that's exactly what I wanted!!
B
3
Posts: 8
Reputation: 193

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests