Best way to handle shmup bullet patterns?

0 favourites
  • 5 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • 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. <img src="http://i.imgur.com/rgoCe.png" border="0" />

    It's really messy, but I'm new to this so yeah. Any ideas?

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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:

    <img src="http://i.imgur.com/YWJdP.png" border="0" />

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

    <img src="http://i.imgur.com/tMpTq.png" border="0" />

    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.

  • 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:

    <img src="https://dl.dropbox.com/u/53374990/Forum/01.png" border="0" />

    the angle is set by an instance variable that gets added to on each shot.

  • It works! Thanks! I'm learning a lot here, you've been great help. Much appreciated.

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