How do I set position of sprite when changing layouts...?

Get help using Construct 2

Post » Sat Aug 09, 2014 9:25 pm

I have 2 layouts or maps.

On layout 1 (home) I have a sprite who walks left and right. When he leaves the edge of the screen, the layout changes to layout 2 (world map)

I was going to make several points of interest on the world map so when you leave an area, the sprite on the world map gets positioned near the point of interest. The issue i am having is changing the position of the world map sprite to where I want.

So if you leave your home the sprite on the map should be near the home icon, if you leave the forest, the sprite should spawn near the forest icon. Any ideas??

Also I am using 1 event sheet for both layouts.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Sat Aug 09, 2014 9:32 pm

You can use instance variables for icons on world map (to separate one from another) and 1 global variable to track player position.
So if player enters Icon with variable "place1" or "1" - depends how you set this up. Then you set global variable to that instance variable
global var "pos" set to "place1"

and then after returning to the map you need to compare these and place player sprite on appropriate Icon.
If icon variable = global var "pos" - set player position to icon position
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Sat Aug 09, 2014 10:00 pm

Thank you. instance variables is what was needed.
B
15
S
4
Posts: 31
Reputation: 1,267


Return to How do I....?

Who is online

Users browsing this forum: Iquerno and 35 guests