How do I make my player teleport to certain rooms when pressing E on other objects?

0 favourites
  • 5 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • I'm doing a question and answer game. I wanted my player to be taken to another place when I press E on a door, is it possible?

  • On the door object add 2 instance variables for x and y co-ord, then have an event when pressing E and overlapping door : set player position to door.varx, door.vary. In the editor view you'll need to set those variable values on the doors to where you expect the player to move.

  • On the door object add 2 instance variables for x and y co-ord, then have an event when pressing E and overlapping door : set player position to door.varx, door.vary. In the editor view you'll need to set those variable values on the doors to where you expect the player to move.

    Well... I'm still learning about construct 3, can you elaborate a little more?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The C3 Events should looked something like this:

    ?? <-- For Trigger (that is also a condition)

    ? <-- For Condition

    ~ <-- For Action

    Code:

    ?? Keyboard Pressed 'E'

    ? Player (Is Overlapping 'Door')

    ~ Player set position X:... Y:...

    ---------------------

    Pay attention that "Player" Object Must be a Sprite Object.

    For this example, we will need 1 Sprite Object for "Player, 1 User Input Plugin named "Keyboard", and 1 Sprite or Tiled-Background or TileMap or almost anything else.

    Looks, I am not sure, but It think Sprite Object (Player) can detect collision (overlapping) from almost anything. But for more precise and custom box collision, you should use Sprite-Sprite collision... So I recommend the "Door" object to be a Sprite Object for you because you are newer here.

  • The C3 Events should looked something like this:

    ?? <-- For Trigger (that is also a condition)

    ? <-- For Condition

    ~ <-- For Action

    Code:

    ?? Keyboard Pressed 'E'

    ? Player (Is Overlapping 'Door')

    ~ Player set position X:... Y:...

    ---------------------

    Pay attention that "Player" Object Must be a Sprite Object.

    For this example, we will need 1 Sprite Object for "Player, 1 User Input Plugin named "Keyboard", and 1 Sprite or Tiled-Background or TileMap or almost anything else.

    Looks, I am not sure, but It think Sprite Object (Player) can detect collision (overlapping) from almost anything. But for more precise and custom box collision, you should use Sprite-Sprite collision... So I recommend the "Door" object to be a Sprite Object for you because you are newer here.

    It worked, thank you very much

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