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 ). 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!
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)
}
}