Easiest way to program an enemy that multiple-shoot randomly

0 favourites
  • 8 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • hello folks,

    I am working on the final boss of a game, I should plan its attack, which is to shoot a dozen objects at random angle and speed, which if they collide with the Player, will hurt it.

    How do you recommend me setting the programming?

    I've found that collisions with Particles are not possible ...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just make use of random or choose, If you set angle to choose(0,90,180,270) every X seconds then it will fire in one of 4 random directions. You can do this with speed, setting it randomly as often as you like. If it's preset patterns you can do this with functions, randomly call a function which leads to firing a certain sequence of bullets. A spiral pattern would be something like every tick fire a bullet and set angle to angle+1.

  • Just make use of random or choose, If you set angle to choose(0,90,180,270) every X seconds then it will fire in one of 4 random directions. You can do this with speed, setting it randomly as often as you like. If it's preset patterns you can do this with functions, randomly call a function which leads to firing a certain sequence of bullets. A spiral pattern would be something like every tick fire a bullet and set angle to angle+1.

    thank you very much, i have tried with only one object and works fine, but after 20/30 seconds of gameplay, I noticed a sharp decline in performance, it started to slow down to almost block everything.

    did I do something wrong? Or what can it depend on?

  • Check in debug mode on the left to see if hundreds of things are spawning every tick and possibly not being destroyed. If the image for the bullet is huge and being spammed it can also cause performance issues. If you can't see anything then you can share capx for easy debug.

  • Check in debug mode on the left to see if hundreds of things are spawning every tick and possibly not being destroyed. If the image for the bullet is huge and being spammed it can also cause performance issues. If you can't see anything then you can share capx for easy debug.

    When the boss shoot, objects go to 94 then duly destroy and return to 93, the object is only a 16x16 pixel frame...

  • im sorry nevermind the problem is the BIG boss sprite, nothing to see with bullet ^^

  • Alright np, could've deduced that with the capx anyway, which would've been the next step!

  • Alright np, could've deduced that with the capx anyway, which would've been the next step!

    thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)