?Position On Layout After Exiting A Building? How?

0 favourites
  • 7 posts
From the Asset Store
Isometric Stategy Roleplay Game Building and Streets Pack.
  • Hey guys, I created the account for this question. This site has helped me with alot. Still new to the game creating world.


    I created a basic game so far with 2 layouts (1st layout being "outside on the streets, with one store"), when you collide with the store it spawns me on my other layout (the 2nd layout being "in the store") exactly where I want it to. But when I exit the store and go back to my "Layout 1" (the streets) it spawns me all the way back at the top right of my layout instead of just outside the store. Helpp???


    • I know what "x" and "y" coordinates I need it to spawn when exiting the store. Just dont know what events (and on which event sheets) I should be doing.

    Appreciate the help in advance,


  • And please dont foward me to the event sheet manual lol :P That page taught me a lot. But I cant quite catch this one :S

  • can you upload your capx?

    i think you need to set a guide sprite or something like that so when the player enter in the store he spawn to the right of the guide sprite and when he leave you should do something like if player is in collition with sprite spawn him in an x,y position in the layer 1.

  • You'll need a variable like 'Location' which tells you where your player object just was. Then, create a 'start of layout' event and add sub events like:


    .. set position to X,Y


    .. set position to X,Y

    Set location to WhatEverLocationCurrentLayoutIs

    That is one way to do it, there are probably better ones :)

  • Well I think it should work if you create 2 global variables called StreetX and StreetY. Make sure the initial values are the X & Y where you want the player to start the game. So as vee41 says, on the street level do a 'On Start of Layout' event and create 2 actions called [Set Player X to StreetX] and [Set Player Y to StreetY].

    Thee second part is that when the player collides with the store, create an extra 2 actions which are [Set StreetX] and [Set StreetY]. Make sure these are the X & Y values you want to player to reappear in when leaving the store (set them just a little away from the store so the collision event is triggered again).

    You could do this for every building your player goes into, so they always return to where they were when back on the streets.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You guys are the best. This forum thing really does help. I'm guessing that the free edition of Construct 2 doesn't have Global Variables in the projects tab lol? Don't see it anywhere there.

  • right click in the event sheet and it should be there

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