How do I make my enemy teleport to a an door with a different number?

0 favourites
  • 5 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • i have 2 of the same object but with different numbers i want the enemy to teleport to the one with number 2 when they touch the door

    how do i make this work

  • Have two variable on the door object which is the ID of the door to teleport to and also its own ID.

    Put the teleport event inside a function something like, pick door where door.ID=param : set position to door

    Then call the function when you overlap a door, pass as the param the door you are going to

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the doors are different values so that way the npcs room other rooms if they are set to alert mode they go to the nearest door but when they hit the door they check the last know place the player was at then they teleport to that door that allow them to go check there so the first door has a value of 1 the second has a value of 2 the the last know object sets it number to the room number then the ai knows what room to go so the ai sets it number to the door value i am not understanding very well on how to do this

    Edit: got it working now

  • That logic looks kinda reasonable. Based on that design I don't think there's a need for the variable on the enemy then, you can just pick all doors and say pick door where roomarea is lastknownroom that should be enough. The inverted condition about UID I don't know what the use is.

    Also move lastknownroom to a global variable so you don't need to keep picking that green object and you can easily track it in events and for any bugs occurring.

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