How do I program flying and running platformer enemies

Get help using Construct 2

Post » Sat Apr 19, 2014 10:38 am

So I'm making a platformer/bullet hell type thing but I'm having trouble with the enemies' behavior. I want some that run around on the ground, some that fly etc. but the only way I can think of programming them is with the platform behaviour (as gravity and solid interaction is necessary) but this absolutely ruins performance as I need around 20 enemies on screen. Is there a more efficient way to do this?

On a similar note bullets colliding with walls is pretty expensive in terms of cpu when there are lots of bullets, any advice for this?

Thanks!

Here's the capx, sorry if the event sheet is a bit of a mess: https://www.dropbox.com/s/enepa24ikhhnp ... Thing.capx
B
23
S
4
G
1
Posts: 71
Reputation: 8,346

Post » Sat Apr 19, 2014 10:52 am

There is a tutorial how to make enemy ai. https://www.scirra.com/tutorials/40/bas ... and-arrays

For flying enemies use 8 directions or custom movement behaviors.

Are you doing this for mobile or pc? 20 enemies shouldn't be that bad on performance! For performance, just make them shoot less often, because I assume they're shooting on tick? ( can't open capx cause im on 163 )
Then set it to every 0.5 sec for example. Also make sure that whatever is not necessary to be turned on, will be off if its not used.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Sat Apr 19, 2014 11:02 am

I'll take a look at that guide, thanks! PC, I'll be honest though, I've only tested on a non gaming laptop but in the past my other games have ran fine. To be more specific, 40-50% of the cpu is taken up by "engine" and another 30-40% by events.

They shoot every random(1,2) seconds at the moment. I have quite a few event groups that switch on/off when necessary so think I'm okay on that front.

Thanks for your help, hopefully someone else will be able to open the capx and tell me I'm being an idiot!
B
23
S
4
G
1
Posts: 71
Reputation: 8,346

Post » Sat Apr 19, 2014 1:45 pm

Just an outside the box thought here for your flying enemies:

Another option could be to give them the platform behaviour and get them to walk (fly) back and forth across invisible platforms with edge markers to stop them going off the edge :)
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Sat Apr 19, 2014 2:47 pm

The way I currently do it is by making them platformers but with 0 gravity, this works better for me as the height they fly at isn't constant. I think the issue is too many platform behaviors anyway. But thanks for the suggestion
B
23
S
4
G
1
Posts: 71
Reputation: 8,346

Post » Sat Apr 19, 2014 2:47 pm

As a side note, if people who download it could check how it runs (so I know if there is an issue or not) that would be fantastic. Thanks!
B
23
S
4
G
1
Posts: 71
Reputation: 8,346

Post » Sun Apr 20, 2014 2:05 am

For flying enemies you could give them the bullet behavior and set the angle to the player every 0.5 sec and you could use able them until the player can see them this way they are just sitting still until needed.
You could also use the bullet behavior for waling enemies as well just have them run between 2 checkpoints.
B
29
S
6
G
1
Posts: 93
Reputation: 3,020


Return to How do I....?

Who is online

Users browsing this forum: Elliott and 19 guests