How do I return a sprite to same position after layout chang

Just started using Construct 2? Post your questions here

Post » Thu Sep 01, 2016 10:32 pm

Sprite starts on Layout 1 at x0,y0. Player moves it to x100,y100. This movement triggers layout 2 (the sprite is not used in layout 2). When clicking a button on Layout 2 to return to Layout 1, the sprite shows up back init's original position of 0,0 rather than at its last moved to position of 100,100. How do I return to Layout 1 with the sprite showing at the last moved to position of 100,100?
B
9
S
3
Posts: 31
Reputation: 708

Post » Thu Sep 01, 2016 10:46 pm

See if this helps. https://www.dropbox.com/s/dkqrwnwdz75qh ... .capx?dl=0

Basically use a global variable to keep track of where you came from, and have multiple spawn locations based on that variable.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Fri Sep 02, 2016 6:59 pm

Got it oosyrag. Thank you!
B
9
S
3
Posts: 31
Reputation: 708

Post » Fri Sep 16, 2016 2:35 am

If you're going for something like an inventory screen, where you can leave from anywhere on the map, you can just add the "persist" behavior to all the objects in your first layout that move or can be destroyed during the game. The only new thing is that you have to add the "reset persisted objects" action if you want the level to actually reset later on.
Eh, Steve!
B
113
S
54
G
13
Posts: 112
Reputation: 16,095


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests