The boy that Rides a Unicycle | Game Jam 4

This is my first Game Jam and here is my first game ever!

The boy that rides a Unicycle

This is a pretty basic game where you are a boy that rides a unicycle (obviously :smile:). You were magically transported into a dungeon where a spikey machine is trying to kill you. You must avoid it for as long as you can!

This was created by me, @Johnnydb.

Link to game: https://github.com/JohnnydCoder/boyThatRidesUnicycle

This game’s license is MIT.

Screenshot:
The%20Boy%20that%20Rides%20a%20Unicycle%20Title

2 Likes

Could you please post a screenshot or gif of gameplay as well? :slight_smile: I can’t play it right now but am curious!

1 Like

Here you go @drummyfish!

The%20Boy%20that%20Rides%20a%20Unicycle%20Gameplay

3 Likes

Thanks, going to give it a go :slight_smile:

Is the title reference to the meme?

EDIT:

Plays nicely! Good job :slight_smile:

I think I sometimes see a bug where the spikey jumps from the bottom of the screen right to the top. I am going to investigate it.

EDIT2:

Or is it supposed to? Looks like it is from the code. I thought it was just supposed to bounce off the wall, but it can also wrap around the screen, right?

EDIT3:

You can replace the whole spikeyMovement function with this if you want shorter code:

void moveSpikey() { // it's best to name functions with verbs
  spikey.x += moveRight ? 1 : -1; // move according to direction (using ternary operator)
  spikey.y += moveDown ? 1 : -1;
  
  const int w = WIDTH - SPIKEY_WIDTH;
  const int h = HEIGHT - SPIKEY_HEIGHT;
  
  if (spikey.x >= w || spikey.x < 0) // if outside bounds
  {
    if (rand() % 5 == 0)
      spikey.x = (spikey.x + w) % w; // wrap around the screen
    else
      moveRight = !moveRight; // change direction (bounce)
  }

  if (spikey.y >= h || spikey.y < 0) // if outside bounds
  {
    if (rand() % 5 == 0)
      spikey.y = (spikey.y + h) % h; // wrap around the screen
    else
      moveDown = !moveDown; // change direction (bounce)
  }
}
1 Like

You’re welcome!

No it is not a reference to a meme.

Yes, that is not a bug in the game, it was fully intentional.

Thanks for the code!

1 Like