i can't make a actor stop with change velocity?
hi all, i have my actor changing velocity to random (0,360), speed=120, but when this actor collides with "hero" i want the actor to change position to top of the screen and to no longer moves, i try creating a self attribute, when move. is true to change velocity to 120, when move is false to change velocity to 0. so i set the rule when this actor collides with hero to change "move" to false, but it keeps moving, i try also to change x and y linear velocity to 0, constraining x and y position to a specific location but no matter what this actor keeps moving. i just need this actor to change x and y position to top of the screen and not to move after it collides with my hero.
Best Answer
-
CodeMonkey Posts: 1,803
If it has physical collision(with the collide behavior) then the collision may be changing the linear velocity. Also if there is any gravity or accelerate behaviors affecting the actor then that might be changing the linear velocity as well.
Answers
simplest:
[optionKey] + drag the prototype to make a copy of the moving actor
name it movingActor2 or whatever … and delete all the rules/behaviors on it
on movingActor
Rule: when
Event: overlaps/collides with hero
--Spawn: movingActor2 at the correct X and Y relative to scene
--Delete this actor
Otherwise:
--changeVelocity behavior
In your case, you could do the above, then just change the hero's x and y to the top of the screen.
The total halt trick doesn't suit all situations but it sounds like it might help here.