Creating a Bop It Style Game

I am working on a game where it’s going to guide the player on what they have to do. The game is going to be presented with a 3D model with six colours around it. The six colors are:

  1. Red
  2. Blue
  3. Green
  4. Blue
  5. Orange
  6. White

Basically, i want to write a script where the game randomly selects one of the six colourss and play the sound clip that goes along with it. But here’s the next part of the script. I want to program the game so that the player scores a point for the first two colours they succed on level one and then on level two onwards they only score a point on the last colour. Also I have two sound files of the same colour (red1.wav red2.wav blue1.wav blue2l.wav etc). How do i add to the script that the last colour of each level is always the second sound file not the first one?

Hi there,

you only need to keep track of how many Bops there are per level, what the current bop count is and what colour needs to show.

The first two can be tracked with integers. The colour could be either an integer or an enum or anything sensible really.

Every time you are executing your code to change colour/play sound check if the currentBopCount < maxBopsPerLevel - 1. If it is play AudioClip 1 for that color else play AudioClip 2.

I imagine it would be something along the lines of:

public void DoBop(BopColor color,  int maxBopsPerLevel, int currentBopCount){
  bool isLastBopOnLevel = currentBopCount < maxBopsPerLevel - 1;

  switch(color){
        case BopColor.Red:
             //switch color

             if(isLastBopOnLevel ){
                   audio.playOneShot(redClip2);
             }
             else{
                   audio.playOneShot(redClip1);
             }
        break;

///same for other colours

}

currentBopCount++;

}

I hope that makes sense.

Kind Regards,
Joe

1 Like