Assignment 3 – Sega Game – Pikachu Racing
Posted by Andrew Wegener on October 9th, 2012
For my third Scratch game, Professor Rueda asked for a Sega Genesis level game. Through my research, I noticed many of these included side scrollers and functions such as jumping and/or gravity (or at least the illusion of it). I started searching the web and the Scratch forums for how to accomplish these “advanced” techniques. Turns out, it wasn’t too difficult – just some fancy variable and math tricks basically. Before I came up with a concept for my game, I just began experimenting with these side scrolling and gravity scripts. Using the default Scratch cat – I will call him “Lunchbox” the cat (I think it makes a great cat name) – I made the game scroll left and right and made Lunchbox jump (and bounce, but that was unnecessary). Shown below are the scripts for those.
Lunchbox the cat!
Shown above is part of the logic on Lunchbox. The If/Else statement at the top concerns the gravity and bouncing of Lunchbox when he/she lands. While the bottom If statements affect the ScrollX variable which is explained below.
This short script is applied to each terrain sprite. It determines the placement of each sprite based off of Lunchbox’s input. 480 is the width of the screen, so when multiplied by one and added to the “position” of Lunchbox, you can figure that this brick of logic is actually the second piece of the level (the first piece would say set x to scrollX + 480 * 0). It was confusing at first, but once I experimented with the values, it made more sense.
From here, I had no idea what to do. I hadn’t even thought about what my actually game would be. I enjoy Pokemon, so for no other reason than that, I decided to do a Pikachu racing game. During my research, I realized many Sega games had multiplayer capabilities, so I wanted mine to have that feature, too. I found some cute Pikachu sprites, and made Pikachu run.
When the space bar is pressed, RunPikaRun would be broadcasted. Pikachu would jump 40 pixels and cycle through the costumes. If space was pressed before the cycle finished, Pikachu would fall (it’s ADORABLE) and would stay there until space wasn’t pressed for 1.3 seconds.
AWW :}
I decided to add hurdles into the game to increase the difficulty and skill required to win. I attempted using a ghost block, which worked – it was being detected – but wouldn’t function the way I wanted when Pikachu was commanded to jump. However, the inevitable tripping at every hurdle was quite amusing and brought joy to the faces of my evil, Pikachu-abusing classmates. Once Pikachu was running properly (badoom psh. Get it? Running?), sort of, I duplicated it and made a blue-cheeked Pikachu – Or Pikablue as I should have named it. With different button commands, simultaneous play was available for head-to-head racing.
Go Pika!
Posted in C++ Programming, Scratch Games | No Comments »













