I've been working on my latest project for a while now (it's an action rpg platformer), and while I've got most of the basic engine done (seemingly 100% bug free ), there's one thing I can't fix. I have my code written so when the player's X position is less than the enemy's, the enemy will move left, and the opposite for the right, which works fine... but when I have multiple enemies, they react as a group. For instance, if I am to the left of both foes, they move towards me normally, but if I jump between them, they both keep going left, even though one should turn to the right. They also refuse to attack unless both are in melee range at once. So basically, I know why this is happening (it's part of the way TGF handles code, I believe), but I don't know how to fix it. Is it possible to fix in TGF, or must I compile my game into MMF? If it's possible, does anyone know how, and would you tell me?
Thanks in advance.
won't you look up at the skyline
at the mortar, block, and glass
and check out the reflections in my eyes?
you see they always used to be there
even when this all was grass
and I sang and danced about a high-rise
X Position of X (Player) is LOWER than Enemy: Set Direction of Enemy to LEFT
X Position of X (Player) is GREATER than Enemy: Set Direction of Enemy to RIGHT
If you're doing that, then that might be where you're going wrong... try inversing it. For instance:
X position of X (ENEMY!) is LOWER than PLAYER...
See if that does anything. It could also be the way you've coded it... I'd be happy to take a look at the source for you.
n/a
Pete Nattress Cheesy Bits img src/uploads/sccheesegif
Woot! Thanks Circy, your method worked perfectly. Thanks also to Pete, the article you linked me to is great as well, and it'll definately help with other things. You guys rock.
-EDIT-
Oh yeah thanks to Jannis for writing the article in the first place.
Edited by the Author.
won't you look up at the skyline
at the mortar, block, and glass
and check out the reflections in my eyes?
you see they always used to be there
even when this all was grass
and I sang and danced about a high-rise
However - couldn't edit the post, so 'ere we go. Uploaded the pictures and edited the urls, but the formatting is all effed up because the script seems to erase all "=" and replaces them with some weird stuff that might get a "=" displayed but is of course no proper html. So no alternative texts and no image aligning!!