The Daily Click ::. Forums ::. Klik Coding Help ::. Shooting enemies help
 

Post Reply  Post Oekaki 
 

Posted By Message

eyeangle



Registered
  12/06/2003
Points
  1683
30th November, 2003 at 22:18:24 -

What's the equation so that enemies only shoot at you if you are on the same platform as they are:

 
theonecardgame.com

cake



Registered
  13/12/2002
Points
  1173
30th November, 2003 at 22:34:08 -

Compare Y coordinates to see if they are on the same platform. Also its better to make them only shoot when you get closer to them so use X coordinates too.

Y("enemy") < Y("player") + 32
+ Y("enemy") > Y("player") - 32
+ Abs(X("player") - X("enemy")) < 200:
shoot ("bullet") at (0,0) from ("player")

You have a give or take of 32 pixels with the Y coordinates there, so that can be tinkered around with to balance it.

Image Edited by the Author.

 
n/a

eyeangle



Registered
  12/06/2003
Points
  1683
2nd December, 2003 at 01:14:37 -

I don't understand what you mean by:

+ Abs(X("player") - X("enemy")) < 200:

WHat does Abs mean...?

 
theonecardgame.com

Muggus

Possibly Insane

Registered
  31/07/2002
Points
  2958
2nd December, 2003 at 06:03:50 -

The Absolute value of a function. If your not using MMF, the only way you can get the Absolute value will be using the Advanced Math object I believe.

Absolute value gives you simply the value, ie Abs(69) = 69, Abs(-69) = 69.

</maths lecture>

 
MUGGUS
Come and annoy me more at
www.muggus69.tk
STOUT ANGER!!!

eyeangle



Registered
  12/06/2003
Points
  1683
2nd December, 2003 at 07:48:44 -

Can you get the advanced math object for tgf...? I have looked everywhere for it.

 
theonecardgame.com

renneF



Registered
  02/08/2003
Points
  672
2nd December, 2003 at 08:27:38 -

yea u can, get it from: objects.ebw.ca

 
Image

eyeangle



Registered
  12/06/2003
Points
  1683
2nd December, 2003 at 19:21:45 -

na that's only for CNC & MMF

I want TGF one.

Image Edited by the Author.

 
theonecardgame.com

cake



Registered
  13/12/2002
Points
  1173
3rd December, 2003 at 04:54:14 -

You can do it without using Abs(), sorry I didn't know you were using TGF. Here is the way to do it without Abs() :

Y("enemy") < Y("player") + 32
+ Y("enemy") > Y("player") - 32
+ X("enemy") < X("player") + 100
+ X("enemy") > Y("player") - 100:
shoot ("bullet") at (0,0) from ("player")

 
n/a
   

Post Reply



 



Advertisement

Worth A Click