The Daily Click ::. Forums ::. Klik Coding Help ::. Unaccurate shootng enamy
 

Post Reply  Post Oekaki 
 

Posted By Message

flashfire



Registered
  03/12/2010
Points
  7
11th January, 2011 at 06:30:10 -

Whats the easiest way to make and enemy shot at a player but at a variable y coordinate so the enemy doesn't just shoot accurately at the same spot each time, was trying to do something like ths shoot relative to x player and y player(+rand 10 - rand 10) but i cannot find an advanced window for y coordinate

 
n/a

flashfire



Registered
  03/12/2010
Points
  7
11th January, 2011 at 07:04:35 -

there may be an easier way. But i have made the bullet move a random of 70 pixels up and down by adding a random(70) to variable a and subtracting a random(70)from that then using a second variable to lock the first variable so the event doesn't keep applying an new variable. it then runs a fast loop that moves the bullet up or down (positive or negative) and and sets "A" back to zero by subtracting or adding 1 from "A"

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
12th January, 2011 at 18:05:19 -

I guess that's one way of doing it, but not the way I'd choose.

I'd use a standard 360 degree movement for the bullet (using Sin & Cos).
Calculate the angle from the enemy to the player, using ATan2.
Add a random amount to the angle before shooting.

If you don't know how to do any of that, then search - it's all been discussed many many times before.
This should be a good place to start:
http://www.create-games.com/download.asp?id=8261

Edited by Sketchy

 
n/a
   

Post Reply



 



Advertisement

Worth A Click