Move an object to another layer

Get help using Construct 2

Post » Thu Feb 16, 2012 2:16 pm

Hey guys!

I'm working on a top-down action game (kinda like the old GTAs :) ).
I wanted to implement that the player could enter buildings, so I made an extra layout for every building.
In that building I spawned an instance of the player. But when I want to go back I found no proper way to tell the game where the player was before entering the building. He is always spawns at his start position of the layout.
I had the idea that I could create global variables for every building wich include the spawn-position next to the building. But that didn't work...

Mabe you guys have some ideas. :)
I hope this problem for Construct 2 wasn't posted already, but I didn't find anything in the FAQ or using the search.

spinz89 :)
B
6
S
1
G
2
Posts: 17
Reputation: 1,341

Post » Thu Feb 16, 2012 4:21 pm

[code]global number x = [insert the starting X position]
global number y = [insert the starting Y position]
On start of frame
-> player: set X to x
-> player: set Y to y
On entering a bulding
-> set x to player.x
-> set y to player.y
-> go to layout building[/code]
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Feb 16, 2012 8:14 pm

What a great idea thanks! :)
So simple but I couldn't work something like this out... :-/ :)
B
6
S
1
G
2
Posts: 17
Reputation: 1,341


Return to How do I....?

Who is online

Users browsing this forum: Renfd, supreme676 and 27 guests