enemies that bounce off of the hero. Not a platform game.

Hi All!

I am building a non platformer game viewed from the top. I have a hero character that is surrounded by several enemies. I want everyone to be able to bounce off one another. RIght now I have it programmed to where the enemies follow the hero, and when they collide, they both just rub up against each other, and do not bounce off. Any suggestions???

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    If they collide with the hero, make the enemy move in the opposite direction for .1 seconds - this will make them bounce off.

    Off the top of my head, if you're tracking X and Y positions for the hero, the rule would be something like.

    If collide with here
    AND
    if self.X is greater than hero.X
    for .1 second
    Move to the right

    Or something like that. Experiment! :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • dilferddilferd Member Posts: 6
    TY! I will try it now!
Sign In or Register to comment.