Spawning in games is a term you usually hear for power ups, zombies, or player/characters. It is not usually a term that you hear for water drums… until now! In my latest commit for the water drum game, where I decided to make it possible to “spawn” new water drums.

wd2

Essentially, I wasn’t sure that there would always only be 5 drums, and at this early stage, it is pretty easy to write in the ability to add more drums later. Since I only have 5 water drum sounds, I thought I could write some code that would divide the number of the drum you are playing and determine which of the 5 sounds should be used for it. We’ll see how that works out!

Here’s the important part of the commit, if you don’t have time to read it in full:

delete[] waterDrums;

waterDrums = new WaterDrum[numDrums];

for (int i = 0; i < numDrums; i++) {

float y = resolution.y/7*2;

if (i%2){

y = resolution.y/7*4;

}

// Spawn the new water drum into the array

waterDrums[i].spawn(resolution.x/7*(i+1), y, i);

}

Right now, I’m working on drumming up a storm!

Linux – keep it simple.

Leave a Reply

Your email address will not be published.