How do I set the position of an object via instance variable

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Currently, I am trying to make it so when the player collides with a certain sprite, the player's position will be set to another sprite with a certain instance variable. A better way of putting it is: When the player touches a staircase, they are brought to another staircase. The staircases touch has a variable called "Warp". Each staircase has a different variable. When the player touches a staircase with a warp variable of 0, they are sent to a staircase with the variable of 1. The game this is needed for is a top down shooter.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have a matching instance variable on your character or whatever is warping, also called warp or playerwarp.

    Set the player.warp to match the stairs.warp+1 so it matches to the stairs you want the player to appear at. Do stairs.warp-1 if you want him to go backwards (down the stairs instead of up, etc)

    Next compare the values of the variable.warp between stairs and player (for each stairs -> stairs.warp = player.warp)

    Then set the player position to the XY of the matching stairs. Then set the player.warp to something like -1 so he can move again to the next stairs. If his varibale remains the same as the stairs he will be unable to move.

    ~Sol

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