Andrew Wegener's blog

Hong Kong thoughts

Archive for the 'Scratch Games' Category

Assignment 4A – PS1 Game – Banjo Kazooie

Posted by Andrew Wegener on 9th October 2012

Two weeks before I left for Hong Kong, I had major reconstructive surgery on my knee.  While I was glued to the couch, I needed something to keep me busy.  What other than video games to save the day, right? :D This idea led to me hacking my Wii.  It was surprisingly easy!  I downloaded a GBA emulator with Pokemon Red along with an N64 emulator with an assortment of games including, but not limited to, Mario Party, Donkey Kong 64, Pokemon Snap, Yoshi’s Story, and of course, Banjo Kazooie (and the sequel, Banjo Tooie).  Although some of these games don’t work (example: Pokemon Snap you cannot turn the camera, the Pokemon sensor red light thing doesn’t light up, and every picture is black when you talk to Professor Oak after each run), Banjo Kazooie runs pretty well.  The opening cinematic doesn’t line up with the music properly, and there are a couple of color issues – the usually black shadows are orange for some reason – but overall the experience is virtually the same – fantastic.  Since I’ve been in Hong Kong, I’ve been playing during the little free time I’ve had.  Fortunately, my childhood memories of the game have served me well and I have completely finished the first 7 levels (100 note score, all moves learned, all jiggies, both empty honeycomb pieces, and even the cheato books!).  Rusty Bucket Bay is next, but before that, I had to make a Scratch version of Banjo Kazooie.  Quick tangent: I’m listening to music as I’m writing this, and a Banjo Kazooie sound effect just played (I downloaded about 300 sound effects from the game). Awesome timing!

Fortunately, I already had a side scrolling script AND gravity from Lunchbox’s experiments.  This saved me a bunch of time and helped me get started right away with the “fun” stuff and got me excited to work on this project.  This was assigned on a Wednesday, and that Friday we happened to have a make up class, and I practically was finished with about a C-grade project.  Anyway, I started with the sprites.  These are not my own sprites, however, I did edit each and every one of the 200+ (rough estimate) sprites I used.

Banjo!

Before I did any movement, I wanted a simple idle animation for Banjo.  The logic was quite simple for this.  The feeling of getting the script right on my first try felt nice :)

This is about as easy as it gets. Depending on the direction of Banjo, that direction of costumes would cycle through.  Oh, I also discovered the nifty little comments tool which is just like in C++ (I recently learned) how you initiate a comment with a simple “//” followed by the comment.  Cool stuff… for a nerd like me.

While Banjo is going through his Idle animation, Scratch checks to see if a button is being pressed every .1 seconds (defined by the Action variable).

This short but wide brick of script determines the value of Action.  This nested group of logic is too wide to fit on my Macbook screen, but it basically says Action = 0 when nothing is pressed.  If something is pressed, set Action to 1.  This variable’s only purpose is to trigger the Idle animation of Banjo.

From here, everything was pretty much redundant.  “(button) triggers (action x), but only while Banjo is doing (action w) but only if he isn’t doing (action y) or (action z).”

Here is an example: Banjo’s rolling script.  When ‘m’ (attack) is pressed while walking left (‘a’) and Banjo is NOT crouching or  jumping, then Banjo can roll until he is interrupted by crouching or jumping.  Banjo is allowed to jump from the middle of a roll attack in the N64 version.  (more Banjo Kazooie sound effects just played from my iTunes!)

This logic is pretty simple, but it’s my first enemy script (besides the football players in Football Frogger).  All it really says is until it’s defeated by Banjo’s attack, hurt Banjo if touched.  And when it’s defeated, it says “GRRR!” When gruntlingDeath is broadcasted, the honeycomb appears and shoots up and my fancy pants gravity script pull it back to the ground (and it bounces!).

I’m going to try to record some gameplay, so as Mumbo Jumbo says in Banjo Tooie….

Banjo Kazooie is finished! Collect the Jiggy to win!

IMG_1212

^^^^^^^^ click that link to see the gameplay and listen to the super catchy music!

Posted in C++ Programming, Scratch Games | No Comments »

Assignment 3 – Sega Game – Pikachu Racing

Posted by Andrew Wegener on 9th October 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 »

Assignment 1 – Atari Game – Frogger

Posted by Andrew Wegener on 8th October 2012

Our first assignment was to create an Atari-like game.  We are using a free, new – well, new to me – program called Scratch.  It’s a great visual, easy to understand tool for learning programming.  No coding is necessary to create games, but it can be used to create mods and add custom blocks.

I started by doing research on some old Atari games.  My family used to own one a long, long time ago, but I hardly remember playing.  From the options I found, I chose Frogger.  I searched Frogger on the Scratch forum and found a simple, Atari-looking version of Frogger.  I downloaded it and tested it. It add increasing difficulty per level, lives, and sounds.  However, we couldn’t just submit a downloaded file.  I began editing sprites and realized I had to change the logic (code) of the game, too.  It was about this time that I decided to make a football game. I decided to portray one of the biggest rivalries in college football, especially from where I come from – Michigan State University’s Spartans and University of Michigan’s Wolverines.  Frogger = MSU player, cars = UofM defense, street = field, other side of the road = end zone, lives = downs.   The code for the defense was easy (shown below).

Humorously, the players still make car noises (it’s a scare tactic that they teach in the pros).  But to summarize, they are hidden, wait 0-5 seconds, appear on the left, go “vrrrooooom” while moving right (and animated legs which I did on my own –> big deal), then hide when the touch the each of the screen and begin waiting to appear on the left again.

When I finished making the players move, it was too predictable, therefore not as challenging as I wanted.  I changed the code to vary some of the defensive players so they were unrealistically good compared to the actual team (I’m biased. Clearly an MSU fan).  Shown below is the logic for the Wolverine that runs left instead of right like the others.

I believe by default the direction of all sprites is right, so the only change I made was “point in direction -90 [left]” and side the X position to 290 instead of -290 (start from the right instead of left).  Boom.  Variation.

One variation wasn’t enough for me.  I wanted to challenge myself and try to make a defenseman that would run back and forth without disappearing.  This meant I add to make my own logic from scratch (badoom psh – oh how I love nerd humor).  ”Bouncy Man” as I call him, was a bit more complex than the other defenders (shown below).

The biggest issue was setting the proper coordinates for Bouncy Man to turn around at.  Once that was worked out, he worked like a Pikachu on toast (aka good).

In addition, the Spartan was the same code as Frogger, just with a new sprite.  Lastly, I added the touchdown and game over sprites to appear when designated.  Over all, I like the game because it is never ending.  Each level is more difficult than the one before and the game only ends when you lose.

TOUCHDOWN! GO GREEN! GO WHITE! WOOOOOOO!!!!

Posted in C++ Programming, Scratch Games | No Comments »

Assignment 2 – NES Game – Duck Hunt

Posted by Andrew Wegener on 24th September 2012

Originally, I was thinking about remaking Tetris Attack, a game I received free when I purchased my SNES.  I repeat, my SNES, not NES.  After attempted to make Tetris Attack for a couple hours, I realized that I was thinking too modern.  Although it is probably possible to make using Scratch, I ran into issues early on with spacing and the foundational game play mechanics so I quit early on.  I looked up NES games on Wikipedia and saw Duck Hunt.  I was hooked. I thought about most of the mechanics and visualized how Scratch would be able to process them and figured I would be able to do it relatively easily.

I started with the crosshairs and making it follow the cursor. That was simple and it immediately got me excited for the rest of the game.  I referenced the ducks from the original game and made one of my own.  Then, it was time for the logic…

I got the duck to glide around, get shot, and do a cute animated fall, but my first main issue was the fall not being smooth.

The duck would fall, change, wait .2 seconds, change, wait .2 seconds, then fall and repeat again.

unsolved (above), solved (below)

To fix this, I made a broadcast command for the dead fall. This allowed the fall to be continuous, while the switch between costumes occurs.  Also, as shown, I animated the duck flapping it’s wings.

Once the duck was properly working, I made more. Yay ducks. Quack!

Speaking of quack, ducks are not mute creatures, so I had to add sounds.  The built in duck sound worked great for when the ducks appeared and the goose sound was fine for when the ducks got shot.

To increase difficulty, I added limited ammo.  You have one extra bullet than there are ducks.  That also means that I added levels. 4 total levels, maximum of 5 bullets. Each new duck was also 1000 more points than the last – meaning the last (4th) duck  is worth 4000 points.

Finally I added a start screen, game over screen, and a “You Win!” screen with the animated ducks flying around.  After a few more minor bug fixes, the game was basically flawless in terms of bugs.  With a few more hours before I would be calling it a night, I had the idea of a bonus level – “unlimited” ammo and many, many ducks.  Once adding a few extra ducks into the bonus level, I realized I had to change the code of each one.  I had to add a new variable and multiple new broadcasts/when I receive commands to EACH.  I was thinking of adding approximately 60 ducks on the single bonus level.  That would be roughly 60 new variables 120 new broadcasts (plus the When I Receive commands).  I attempted to shorten this process, but when I realized that with the process I was using, it was inevitable.  Maybe if I reconstructed all of my code, it would be possible.  But I already had a solid, bug-free game.  So I decided to cease my ambition and accept my game as it is.

IMG_1213

^^^^^^^ gameplay footage!

Posted in C++ Programming, Scratch Games | No Comments »