Global Position?

Get help using Construct 2

Post » Fri Apr 06, 2012 11:36 pm

Looking to make a game that in theory requires the player to move back and forth between layouts. The game idea would also require the player to drop objects on the ground and come back for them later.

So my question is, is there a way I can load/save an objects position as the player moves between each layout?
B
4
G
3
Posts: 36
Reputation: 997

Post » Fri Apr 06, 2012 11:58 pm

Global variables remain the same between layouts until you change them.
So if you set global.variable("x") to 10 on layout 1, it will be 10 on layout 2. If you change that variable to 20 on layout 2, it will be 20 on layout 3, etc.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sat Apr 07, 2012 4:31 am

This kind of helps me, but what if I want the player to be able to drop object between layers?

I mean this as in, I want the player to only carry one item at a time. If they want to switch it, they need to drop what they have and pick up the other object. I would need this function between layouts

Lets say Layout 1 is outside and 2 is inside. I would need the player to pick up the object in layout 1, drop it into 2 and have its position saved if the player goes back outside and needs to return to it later
B
4
G
3
Posts: 36
Reputation: 997

Post » Sat Apr 07, 2012 5:32 am

Same thing, just use a global to say what layout it is in.
If global.variable("layout") is 1, etc.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sat Apr 07, 2012 6:00 am

You could maintain a list of all such objects. For each object, store the layout it is currently on, as well as the coordinates within that layout.
B
24
S
5
G
2
Posts: 104
Reputation: 3,136


Return to How do I....?

Who is online

Users browsing this forum: badmoodtaylor and 8 guests