• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How do I make a bullet hell “spiral pattern”?

L

Lord Homicide

Guest
So I’m currently attending a college-level game design class despite being in high school, and we’ve all been tasked with making a basic game. We have three months to do it, and so I figured I’d make a basic bullet hell game. I already know how to make some basic patterns and can manage HP, health bars, damage, sprites, etc, but I’m stuck on one critical problem: we’re required to use the demo version of Game Maker Studio 2, which completely limits my plans for making bullet hell patterns. My current method was to make an object for each individual bullet going in a different direction; for example, a basic ring of nine bullets shot by the boss would contain nine separate objects, one for each bullet. However, because the GMS2 trial limits objects to 15, this is extremely impractical.

Basically, I’m trying to figure out how to make bullet hell patterns while only having to use one central bullet object. Patterns like the ones shown in this video would be a good starting point, I just don’t know how to make them; at least, not in an efficient manner. Does anyone have any pointers? Buying the program used in the video is out of the question, of course; it’s not that I’m too cheap/poor to spend one full dollar, it’s just that I feel like buying an outside program to do the heavy programming for me would be like cheating.
 
D

Danei

Guest
Wait, does the trial limit you to 15 instances in the game at a time, or 15 objects in the resource tree?
 

NightFrost

Member
That's a pretty harsh instance limit. As a workaround, I would do something like this... The enemy that shoots the bullets tracks their positions in a DS list, and simply draws them to their proper positions in draw event. It also checks if they are outside screen and removes them from the list. Since the bullets are now merely drawn graphical effect, you can't check for collisions. Instead, the player compares the bounds of their collision square to every enemy's bullet DS list, checks if the bullet's x/y is close enough, and if so, kills the player.
 

O.Stogden

Member
You are limited to 15 objects, not instances. Objects are things like a house. You could only have 15 *different* houses, but you could have 100 instances of 1 of the houses in your game if you wished.

Space Invaders for example probably has only 10 or so objects in the whole game, although there are many instances of those objects.

You can use code to determine their direction, so just make 1 bullet object, and then specify a direction in code, rather than have a separate object for each direction.

For a basic spiral, I guess you could use a counter that makes it fire a bullet every 5 steps, with another variable that increases by 10 or so each time, so you fire a bullet when the counter hits 0, and fire it in the direction of the variable that increases by 10.
 

Alexx

Member
I assume a game like this would have lots of bullets / projectiles / other things flying around.
You could use just one instance for all of these, with a bit of clever coding.
If you would like an example, I'd be happy to do one.
 

johnwo

Member
You're limited to 15 objects, not instances.
Having one object for each bullet is horribly inefficient, and waaaaay more work than the example below...

Example:
Make an object called obj_bullet, then just do something like this:
Code:
// Code for bullet creator
// Create event:
bulletSpiralCount = 32; // Amount of bullets to be spawned
bulletSpiralIterator = 0; // Iterator used for spawning bullets
bulletSpiralInterval = room_speed/8; // Spawn 8 bullets/sec
bulletSpiralSpeed = 4; // Speed of the bullet

alarm[0] = 1; // Start spawning bullets the next step;

// Alarm 0 event:
if (bulletSpiralIterator < bulletSpiralCount) {
    var _inst = instance_create_layer(x,y,"bullet_layer",obj_bullet);
    _inst.direction = (360/bulletSprialCount)*bulletSpiralIterator;
    _inst.speed = bulletSpiralSpeed;

   alarm[0] = bulletSpiralInterval; // Get ready to (potentially) spawn the next bullet
    bulletSpiralIterator ++; // Increment the iterator
}
For the obj_bullet, simply do:
Code:
// Create event
image_angle = direction;
Code not tested...

Theoretically, you could make a game with only one object, albeit it would be unpractical.
 
D

Danei

Guest
Yeah, for a simple spiral, have a shotAngle variable (from 0 to 359) and move it up or down by some amount every step.


Code:
///ENEMY/SHOT EMITTER
///create event
shotAngle = 0;    //initialize that variable


///step event

shotAngle = (shotAngle + 10) mod 360;   //increment that angle but keep it within a range just for fun


var _bullet = instance_create_layer(x,y,layer, obj_bullet);    //create that bullet
_bullet.speed = 1;
_bullet.direction = shotAngle;      //use the built-in variable just so we don't have to put anything in the bullet object

My example is way worse than the one above it, but it's the simplest thing I could think of.
 
L

Lord Homicide

Guest
Thanks for all of the advice, everyone! I’ll try out some of these ideas in class tomorrow and post a follow-up detailing how things went.
 
Top