7
« on: August 30, 2018, 08:06:51 am »
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.