Best way to handle shmup bullet patterns?

Get help using Construct 2

Post » Tue Oct 30, 2012 8:49 pm

So I'm trying to get the basics down on a shmup test game I'm working on. What I can't figure out is the best way to do bullet patterns.

Right now, I'm trying to have an enemy spit out a bullet every 10 degrees, every 0.05 seconds. The only way I can think of doing this is to make it shoot, set angle, wait 0.05 seconds, then repeat. The problem is that it's setting the angle for every bullet, so they end up shooting in the same direction.

It's really messy, but I'm new to this so yeah. Any ideas?darkpivot2012-10-30 20:52:34
B
19
S
4
G
1
Posts: 42
Reputation: 1,793

Post » Tue Oct 30, 2012 10:22 pm

You'll want to search the manual entries for loops!
It'll explain what you need a lot better than me.

but for example, your events could also be done like this:

+Repeat 7 times
     ->System     |wait loopindex*0.05 seconds
     ->Enemy2      |Spawn EnemyBullet on layer1
     ->EnemyBullet      |Set angle to 180-(loopindex*10)

edit: but you'll need to make sure this repeat event isn't run every single tick, otherwise you'll have thousands of bullets.. putting a "trigger once" condition above "repeat.." may be okay.keepee2012-10-30 22:26:44
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Tue Oct 30, 2012 11:35 pm

Thanks! Okay, so I read up on it in the manual and I believe I get the gist of it, but I'm having an error appear from the set angle action:


Not sure what's wrong, but I noticed the wait loopindex is bold while the other is not. Did I enter it wrong?


Edit: It also seems that the trigger once doesn't work. Testing it without the set angle action so it actually works, it's still shooting thousands of bullets. darkpivot2012-10-30 23:39:35
B
19
S
4
G
1
Posts: 42
Reputation: 1,793

Post » Thu Nov 01, 2012 2:55 pm

Right.. sorry, I should have tested this.

The error is because after it has waited, it doesn't remember what loopindex it was on at the time.

also The trigger once just needs to go above the repeat condition.

To solve the angle problem, I did this instead:


the angle is set by an instance variable that gets added to on each shot.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Nov 01, 2012 7:24 pm

It works! Thanks! I'm learning a lot here, you've been great help. Much appreciated.
B
19
S
4
G
1
Posts: 42
Reputation: 1,793


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests