Easiest way to program an enemy that multiple-shoot randomly

Get help using Construct 2

Post » Fri Jul 07, 2017 11:54 am

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 ... :|
B
13
S
7
G
5
Posts: 433
Reputation: 4,690

Post » Fri Jul 07, 2017 1:06 pm

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.
B
47
S
17
G
81
Posts: 2,230
Reputation: 48,107

Post » Fri Jul 07, 2017 3:56 pm

plinkie wrote: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?
Image
B
13
S
7
G
5
Posts: 433
Reputation: 4,690

Post » Fri Jul 07, 2017 4:01 pm

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.
B
47
S
17
G
81
Posts: 2,230
Reputation: 48,107

Post » Fri Jul 07, 2017 4:30 pm

plinkie wrote: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...
B
13
S
7
G
5
Posts: 433
Reputation: 4,690

Post » Fri Jul 07, 2017 4:41 pm

@plinkie im sorry nevermind the problem is the BIG boss sprite, nothing to see with bullet ^^
B
13
S
7
G
5
Posts: 433
Reputation: 4,690

Post » Fri Jul 07, 2017 5:20 pm

Alright np, could've deduced that with the capx anyway, which would've been the next step!
B
47
S
17
G
81
Posts: 2,230
Reputation: 48,107

Post » Fri Jul 07, 2017 9:23 pm

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

thank you
B
13
S
7
G
5
Posts: 433
Reputation: 4,690


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 17 guests