Reply to Re: Making sprites avoid each other
If you don't have an account, just leave the password field blank.
Yeah, I tend to approach things with the view that if someone else does it for me, I haven't really learned anything. I only ask for help if I'm not sure where to start, or am just unsure of something in general...
And yeah, once I get it working (probably sometime tomorrow, I'm kinda tired right now) I'll post it here if anyone's still interested. I was gonna use it for my Carnage Contest entry, but thinking about it it could be used for all sorts of things, like a duck-herding mini game or something of the sort...
@Skull: I think the only bit of code from there that would be similair to this would be the comparing guard's location to Dink. I've already scripted a working bit of code that can tell if sprite A is within a 200 pixel range of sprite B though, so...
Anyway, I'm now working (going off of Kyle's suggestion earlier) a way to get an invisible sprite to appear at a location away from Sprite A, for Sprite B to follow . This is of course harder than it first seems, because I need to make sure:
A.) The sprite always appears somewhere on-screen, never off-screen (otherwise it could get buggy)
B.) It needs to be slightly random, otherwise it'll be far too easy to guess how it tries to evade
and C.) It needs to be at a location so that the evading sprite doesn't walk straight through the sprite it's trying to get away from.
I've already made an extremely messy, extremely rough, but just about working bit of code. So I'm just working my way through it at fixing the above issues and stuff. So yeah, hopefully I'll be done some-point tomorrow.
And yeah, once I get it working (probably sometime tomorrow, I'm kinda tired right now) I'll post it here if anyone's still interested. I was gonna use it for my Carnage Contest entry, but thinking about it it could be used for all sorts of things, like a duck-herding mini game or something of the sort...
@Skull: I think the only bit of code from there that would be similair to this would be the comparing guard's location to Dink. I've already scripted a working bit of code that can tell if sprite A is within a 200 pixel range of sprite B though, so...
Anyway, I'm now working (going off of Kyle's suggestion earlier) a way to get an invisible sprite to appear at a location away from Sprite A, for Sprite B to follow . This is of course harder than it first seems, because I need to make sure:
A.) The sprite always appears somewhere on-screen, never off-screen (otherwise it could get buggy)
B.) It needs to be slightly random, otherwise it'll be far too easy to guess how it tries to evade
and C.) It needs to be at a location so that the evading sprite doesn't walk straight through the sprite it's trying to get away from.
I've already made an extremely messy, extremely rough, but just about working bit of code. So I'm just working my way through it at fixing the above issues and stuff. So yeah, hopefully I'll be done some-point tomorrow.