Reply to Re: Making sprites avoid each other
If you don't have an account, just leave the password field blank.
Sure, I suppose I didn't really explain why I need it, did I?
I'm using it becuase there's a bit in my game where the Player becomes mega-powerful, and all the guards try and run away from the player. But I figured I'd code it all before I actually needed it, so that it was looming over the rest of the project
So essentially, when the players moving around, the guards try and move away from him.
I now have enough code to check if the guard is within a 200 pixel range of the player. Then, if he's in range, that code works out if he's north-west, north-east, south-west, or south-east. I was just about to start coding the bit to work out where he should move to.
I think you're saying check which way Dink's facing, and move the guard accordingly? But that wouldn't work, because even if the player and guard are within range of each other, there's nothing to stop the player just turning around and facing away from him. Which, going by your method, would then make the guard turn around and walk straight towards the player.
Feel free to correct me if I've misunderstood what you meant.
EDIT: @Kyle, Fireball.
This is getting more and more complicated, and more and more confusing as the code progresses
I'm using it becuase there's a bit in my game where the Player becomes mega-powerful, and all the guards try and run away from the player. But I figured I'd code it all before I actually needed it, so that it was looming over the rest of the project

So essentially, when the players moving around, the guards try and move away from him.
I now have enough code to check if the guard is within a 200 pixel range of the player. Then, if he's in range, that code works out if he's north-west, north-east, south-west, or south-east. I was just about to start coding the bit to work out where he should move to.
I think you're saying check which way Dink's facing, and move the guard accordingly? But that wouldn't work, because even if the player and guard are within range of each other, there's nothing to stop the player just turning around and facing away from him. Which, going by your method, would then make the guard turn around and walk straight towards the player.
Feel free to correct me if I've misunderstood what you meant.

EDIT: @Kyle, Fireball.
This is getting more and more complicated, and more and more confusing as the code progresses
