Sent instance variables another layout

Get help using Construct 2

Post » Wed Oct 24, 2012 3:39 am

Hello,
I have many layouts of game levels. Then I need to pass a instance variables of player, who can take a gun and lose the gun, to another layout. How can I do this?
Thanks in advance.
B
11
S
3
G
4
Posts: 22
Reputation: 2,794

Post » Wed Oct 24, 2012 4:08 pm

Hi

Think you can do it several ways.

If you give all your weapons an ID, so pistol = 1, Rifle = 2 etc. Or just strings whatever you prefer. And then store that value as a global variable, like "Player_active_weapon", then you could simply check on layout startup, what value is in "Player_active_weapon". And set that weapon to active on the new layout.

A way that would work i think, is if you make an empty event sheet and call it "Player stats" or whatever, then you can add all the player stats like health, weapons, ammunition or whatever you need in there. These values can be used in any layout you have. That way you can simply update that event sheets variables everytime the player interact with the surrounding.


nimos1002012-10-24 16:09:41
B
40
S
10
G
2
Posts: 1,148
Reputation: 6,495

Post » Thu Oct 25, 2012 7:06 am

Thank you,

It's impossible to pass instance variables?
Cause there are many shooting variables. Gun_1, Gun_2, Gun_3... etc,
B
11
S
3
G
4
Posts: 22
Reputation: 2,794


Return to How do I....?

Who is online

Users browsing this forum: Megavolt, mnashwan, shinkan, stylie1, tarek2 and 18 guests