How do I move to different layouts?

  • Hello everyone I just have a simple question how do I move the character to the different layout. Currently I made in the MAP1 sprite that when you collide with it, it sets the MAP2 layout.

    The sprite that when you collide with it, it will move you to the MAP2 and if you go back it will bring you back to the MAP1. Also how to make it smooth? By smooth I mean if you collide with the sprite which is on the right hand side you will spawn on the MAP2 on the left hand side!

    Big thanks to everyone for any help!

  • Do you mean?

    Map 2

    on start of layout - player set position

  • I mean like when you collide with the yellow spite it will move you to the MAP2 and make it look like you just came out from the left not just spawn in the middle of the map. Thanks for replying!

    MAP1

    MAP2

  • on map 1 event sheet add the event

    On collision with layoutchanger

    system goto layout "Map2"

    on map 2 event sheet add the action

    on start of layout

    player set position (add the coordinates)

    If the player doesn't exist on map 2, either set it to global, or use a system create player action..

  • Hmm I'm doing something wrong :/

    https://www.upload.ee/files/4795992/MAP ... .capx.html

  • Hmm I'm doing something wrong :/

    https://www.upload.ee/files/4795992/MAP ... .capx.html

    That's why I said:

    If the player doesn't exist on map 2, either set it to global, or use a system create player action..

  • You mean set the global Variable for the Players X & Y ?

  • Select the player sprite and in it's (object type) properties set Global to yes..

    Or........

    On start of layout

    system create object player at x=whatever, y=whatever

    but setting the player to global would be the best choice..

  • Oh it worked so basically all I had to do was player set to global YES! It works one way now!

    But I have to do the same other way? or Ill need to use something else? So I can get back to Map 1.

    Sorry this is my first time doing this...

  • I guess you would have to know if the player came from Map 2 on start of layout Map 1 or else the player would always start at the exit..

    setting a global variable (or an instance variable on the player) to layoutname before changing layouts and checking it on start of the new layout would do the trick..

  • The struggle is real ! Do you have any clue how to check it or there is multiple ways to check it?

  • The struggle is real !

    I'm not sure what you mean..

    A big part of learning to program is making mistakes and solving them..

    It's the best way to learn and remember..

    Computers are stupid, you have to tell them exactly what you want..

    If you say:"walk to the table and sit down" to a person, the person will walk to the table, grab a chair and sit down on the chair..

    If you say:"walk to the table and sit down" to a computer, it will sit down..

    if you say:"walk to the table and when you have reached the table sit down"

    The computer will still not grab a chair and sit down on the chair, it will just sit down next to the table..

    If you want it to grab a chair and sit on it, you have to tell it specifically to do that..

    So often you will think you have the right actions/commands, but will find out the computer doesn't understand..

    Solving those situations will make you a better programmer..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The struggle is real ! Do you have any clue how to check it or there is multiple ways to check it?

    To check it you have to compare the variable..

    It's pretty simple..

  • Ok thanks for the speech cheers! No offence! lol

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