Pls help with doors.

Firend

  • Posts: 5
Guys, please help! I need to make a door with which you come across and it play the opening animation but I do not get anything out. Please make the screenshot of the solution.This is a snapshot of the door code.

« Last Edit: August 30, 2018, 05:41:35 am by Firend »

squeeb

  • Posts: 1617
Post a screen shot of your code and we can help you

vicevicebingo

  • Posts: 80
There are over 1 switch animation block is being used in your game
so no people need to make screenshot.

« Last Edit: August 30, 2018, 10:57:22 pm by vicevicebingo »

xplosion28

  • Posts: 275
Well you have to remember we don't know how your game is played.  Is it a top down view, a side scroller, etc, because it does make a difference. 

Not knowing this the conclusion I would come to, is create a boolean named "Open" and set it to false in the door actor.  When a collision occurs between the door and the player:
     -If open = false
             -set open = true
             -set animation to 0 (Door opening animation)

This is where we run into issues, the code above should function just as what you posted (just my rendition).  However we need to know what will happen next.  Is the scene going to change, is it just allowing the player to walk through into a house (of the same scene) because this will determine how to move forward.  If it changes into a new scene, just include a do after block to allow the door to fully open for aesthetic purposes then change the scene.  If it is the latter on the other hand, you will need to find a way to check when the actor has passed the door.  Many ways to do this, in my personal opinion tiles have the greatest advantage because there is a way to check if the actor is on that specific tile and when it is not.  Using actors isn't quite as simple (but still very doable), you could make a sensor just past the door that when the player hits it will change the door animation.  I'm sure there is also a solution using regions, I just have never used them myself but they would allow you to get your desired effect without the use of another actor as a sensor.