The Daily Click ::. Forums ::. Klik Coding Help ::. *Sigh* Seemingly undefeatable multiple enemy problems
 

Post Reply  Post Oekaki 
 

Posted By Message

Killerjedi



Registered
  04/01/2002
Points
  341
7th December, 2004 at 15:02:49 -

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

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48487

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
7th December, 2004 at 15:19:13 -

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

Registered
  23/09/2002
Points
  4811
7th December, 2004 at 15:57:32 -

this article is your god (or maybe that's jannis?) http://www.create-games.com/article.asp?id=1082

that'll allow you to control your enemies individually.

 
www.thenatflap.co.uk

jast



Registered
  03/01/2014 01:12:19
Points
  186
7th December, 2004 at 16:32:59 -

Wow, somebody remembers my article? Geez, now I even have to re-upload the pictures (you know, host change etc.)

 
n/a

Killerjedi



Registered
  04/01/2002
Points
  341
7th December, 2004 at 16:44:05 -

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.

Image 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

jast



Registered
  03/01/2014 01:12:19
Points
  186
7th December, 2004 at 16:46:20 -

Anytime...

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!!

 
n/a

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48487

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
7th December, 2004 at 17:03:00 -

No problemo

 
n/a
   

Post Reply



 



Advertisement

Worth A Click