How do I make the player start in a different position upon a collision?

0 favourites
  • 7 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi I have a student who needs help with her Solution Level II layout. When the player collides with each object like the alarm clock, it brings them to a new layout and then back to the game. However, the player has to start from the beginning and the items such as the alarm clock are still there. I tried adding actions like upon colliding and having the object destroyed and then setting the position of the character to where the alarm was, but it wasn't working. She also has too much of the game play (most of the layouts) in one event sheet, which may be causing the problem. Any advice on how to make the objects disappear after coming back into the game and repositioning the character? Thanks! https://ramsshepherd-my.sharepoint.com/:u:/g/personal/ynuredin_shepherd_edu/EWdiWG267eZFsdW7dO24voIBo8J-7z2S_BhPsKFeaJbOjg?e=8XksXc

  • To keep the alarm clock destroyed give it the Persist behaviour. To change the location you can have something like on collision with alarm clock, set player X to global variable and set player Y to a second global variable. Then on start of layout you set the player position to gv1,gv2. The default values of the variables can be the expected starting position of the player.

  • Thanks. I'll definitely try this.

  • So I gave the clock the persist behavior (Solution Level II layout), added two global variables, set the position of the player to the variables, but when I set the values for the variables as the starting position in the layout, it'll go back to that position rather than starting from where the clock was. If I change the values for the variables to the position of the clock, then it keeps jumping to the PrfSnail5 layout and won't let me get back into the game.

    Also, I have a lot of other objects I want as checkpoints (player collides with object, goes to another layout, and then comes back and starts from that position), so would the solution you mentioned also work for multiple object collisions?

    Thank you for your help! (by the way I moved the events for this layout onto event sheet 3 to try to make it more manageable).

  • In the event when you collide with the object look at the actions, you are setting the position of the player. At this point you should be setting the variables to the position x and y of the player object to store them, you have it backwards.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh I see! That makes more sense! Thank you so much for your help!!

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