How to make a move attribute stop
Gamepenciler
Artist/Game DeveloperMember, PRO Posts: 326
Hello I made an actor with move attribute running from left to right but I want the actor to stop when it is collided with another object and stay in place. How can do that? please help thanks.
-ACE
Artist/Game Developer / Animator at your service..
Comments
While there are many ways to do this, the easiest follows:
Create a self attribute (integer) in the moving actor. Call it CollideState, or something like that. At it to 0.
Wrap your move behavior in a rule that says when attribute self.CollideState is 0.
Crrate another rule that says when actor overlaps or collides with object, change attribute self.CollideState to 1.
When self.CollideState is 1, the rule that had the move behavior wrapped in it will no longer be true, meaning that the behavior will not trigger.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx