how do i insert a value as part of an objects name

0 favourites
  • 6 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I'm currently creating a game that its movements is based on object location, and so i have set up an area with several objects all labeled with name# example: ground23, i want to make an equation that sets the players position to object by its number such as going up means moving from ground23 to ground13. i have the current object number set as a instance variable within the player such as when on ground23 the value is 23, and when u go up the value goes to 13. the problem is the equation i have set up looks like this "on action, set player coordinates to X: ground(instance value).X Y: ground(instance value).Y but it wont accept it it as a acceptably equation. Does anyone know how how i can write out this equation so it would except it?

  • Hi,

    I did not fully understand. You want something to happen to the player when he is on a specific location? That's no problem. You can simply use the "is overlapping" such as:

    PLAYER "is overlapping" GROUND23

    ACTION = whatever you want

    If I did not understand you - sorry.

  • thats not it

    i want the player to be on the objects with the same value as the instance variable in its name

  • though your method would work i would have to set it up for each object in each direction individually

    and that would be to much for 50 so objects each level

  • i found a solution that will work for my game but if some else might use this i would love to still see a solution to this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You said that you use an "instance variable in its (player's) name"

    Why not change this (not use at all) and use only one GLOBAL variable to do this job?

    It can be called PLAYER_POSITION and every time he moves somewhere like GROUND23 you can SET this PLAYER_POSITION to 23.

    Using this 1 GLOBAL variable you always know where your player is and therefore can direct him anywhere you wish such as if PLAYER_POSITION = 23 then put player into position 13.

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