How do I change spawn points based on layouts?

0 favourites
  • 4 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • So basically, I have layouts 1, 2, 3, 4, 5.

    We'll call 1 "home"

    2 "City1"

    3 "City2"

    4 "City3"

    5 "Park"

    All large, with portals to different places.

    When my player enters Layout City1 from Home, she enters at the bottom of the screen. So then she travels through the block and, on collision with the UID of an interact block I have hidden, she transports to a specific location in City 2. The same happens when she spawns into City 3 and Park.

    How do I then make her spawn into a different, geographically appropriate location, when walking back through the city?

    I'm sure this is super simple and I'm way overthinking it. I just have no idea what the heck I'm missing.

    Thanks!

  • Add an instance variable "id" to portal sprites, set different ids for each portal, you can use numbers or text (say, "park_west_entrance"). Add another instance variable "target_id", set correct target/exit ids for it too. For example the eastern portal in City3 will have target_id="park_west_entrance".

    When the character enters a portal, save Portal.target_id in a global variable Spawn_ID. On start of the new layout, spawn the character at the portal with id=Spawn_ID.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LesleyBeth Please refresh the page, I edited my post while you were reading it :)

  • You are a lifesaver. Seriously.

    That is so much easier than what I was trying to do!

    Thank you!

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