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

0 favourites
  • 3 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you. instance variables is what was needed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)