Jump to content


Photo

How to get All enemies to shoot


  • Please log in to reply
3 replies to this topic

#1 eddythedreamer

eddythedreamer

    GMC Member

  • New Member
  • 8 posts
  • Version:GM8

Posted 10 March 2012 - 02:25 AM

Hey All,
I am just trying to get my top down game to work correctly. I am sending enemies to the main to fire on him, which works fine for the first instance only, not any other (then when i kill him, he regenerates and he shoots again).
I am using the Alarm 0 to shoot (create enemy bullet @ enemy.x/enemy.y), then to set Alarm 1, which shoots and resets Alarm 0. Works great for continuous fire for 1, but not for any others. Please help. Code or D&D is good.
Thank you.
  • 0

#2 TechnoGeek4681

TechnoGeek4681

    GMC Member

  • New Member
  • 143 posts
  • Version:GM8

Posted 10 March 2012 - 02:45 AM

If your code or D&D actually uses enemy.x or enemy.y, that's your problem. enemy.x will pick a certain instance of the enemy object on the screen (lowest instance number i believe). What you actually want is to use the variables self.x, self.y or even just x,y (which works the same way). This is all assuming your code is in the enemy object, which I assume it is.
  • 0

#3 lukew23

lukew23

    GMC Member

  • GMC Member
  • 276 posts
  • Version:Unknown

Posted 10 March 2012 - 02:47 AM

Hey All,
I am just trying to get my top down game to work correctly. I am sending enemies to the main to fire on him, which works fine for the first instance only, not any other (then when i kill him, he regenerates and he shoots again).
I am using the Alarm 0 to shoot (create enemy bullet @ enemy.x/enemy.y), then to set Alarm 1, which shoots and resets Alarm 0. Works great for continuous fire for 1, but not for any others. Please help. Code or D&D is good.
Thank you.


rather than create bullet at enemy,x/enemy.y, create it at to 0/0 and tick the relative box. This will create it at that enemy's place, rather than at enemy.x/enemy.y, which is the loction of the first enemy created.

EDIT: ninja'd :ninja:

Edited by lukew23, 10 March 2012 - 02:47 AM.

  • 0

#4 eddythedreamer

eddythedreamer

    GMC Member

  • New Member
  • 8 posts
  • Version:GM8

Posted 11 March 2012 - 01:53 AM

FANTABULOUS!!
Both options worked! I was thinking a step or two too far. I forgot to think of the "enemy" object as itself! So, setting to 0,0, relative worked, and/or setting to x,y,not-relative worked.
Thank you both!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users