Andrew Wegener's blog

Hong Kong thoughts

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 »

Assignment 1 – Atari Game – Frogger

Posted by Andrew Wegener on October 8th, 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 September 24th, 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 »

My Journey to Hong Kong

Posted by Andrew Wegener on September 12th, 2012

Day 5,

This is my first time out of the U.S.A. and it has been quite the experience so far.  My flight from Detroit to Chicago went smoothly – my flight from Chicago to Hong Kong… not so much.  The plane was scheduled to leave around 1pm but was having mechanical issues which delayed us for about three hours.  Once they had an idea of the problem, they rescheduled departure for 8pm that night and provided us with food vouchers.  I had already called Verizon to freeze my account so I wouldn’t get roaming charges, but I called again to unfreeze so I could update the family.  I reschedule the freeze to my account for midnight that night since they will have the problem solved by then.  Come about 6:30pm, there’s an announcement saying we won’t leave until 10am the next morning.  I call Verizon a third time to cancel the freeze on my account and promise myself I won’t call until we’re practically in the air.  Anyway, the airline supplied everyone with hotel and meal vouchers for our overnight stay.  I have no U.S. money because I exchanged all of it for Hong Kong dollars.  I manage to crutch my way through the tiny Chicago airport – sarcasm – and across a couple of busy streets to the shuttle station to the hotel.  I get to my hotel room and I have two queen beds to myself, generous? or insulting?

The next morning I get a hot breakfast and make my way back to the airport.  We get on the plane and go to our new seats.  Our flight number changed due to the delay and that caused an issue with the routing computer.  The pilot decided to input the route manually.  It didn’t work.  He tries again.  Around this time, I meet a very kind woman sitting in front of me named Mary.  She has lived in Hong Kong for 20 years, studied Chinese, has two daughters, and traveled to 26 countries on $3000 in the 70s.  She offered that I sit in the empty seat next to her because the emergency exit row that she was in provides more leg room.  I gratefully accept.  As the hours pass, the pilot comes on the speaker and says the problem has been resolved… however, (prepare yourself for the most ridiculous crap ever) he has been on board the aircraft too long without departing so he isn’t “allowed” to fly the aircraft.  More time passes and they find a new pilot and the flight crew only have minutes left until they have to leave the aircraft too.  Regardless of the fact that the dry ice keeping the ice cream cold had melted, the leave before restocking in order to keep the same crew.  I am still undecided on how I feel about their decision, but I digress.  Finally, we leave the gate and taxi to the runway.  I call Verizon a final time to freeze my account, again.  We get in the air and the whole plane cheers and claps.

Aside from the too narrow of walkways, the tiny bathrooms, and the Asian people that liked to hang out in the exit row and kick my bad leg and open the window that let in a blinding light while I was trying to sleep, most of the flight was fairly enjoyable.  Then JoJo, the flight attendant, helps a young Asian woman sit in the flight attendant chair that’s facing me.  She’s sitting in the chair sideways, sweating, dizzy, and nauseous.  A couple flight attendants gather around and make an announcement asking for medical professionals to identify themselves.  The young woman does the “oh no, I’m going to vomit” lunge forward but keeps it in.  One attendant stumbles to hand her a barf bag.  She does the puke dance again without using the bag, and the next thing I hear is, “Sit her up straight.”  An attendant turns her 90 degrees… Now she is facing me.  I’m only 2-3 feet away and easily in range of any projectile spew she can produce.  I start praying quickly for God’s mercy, but before I can finish she lunges toward me – I lift up legs and my blanket to duck for cover but I kicked her in the nose.  I’m kidding I didn’t kick her.  She keeps it in again, miraculously, and I stay covered under my two blankets (yay special treatment for being on crutches!). Turns out she was 6 weeks pregnant and has only had a half a meal and a small glass of water in the last 15 hours while she’s supporting two human beings.  She gets some water and feels better, and I escape without being sprayed with her glass of water and half a meal.

I also met a fellow SCAD bee on the flight.  Mary introduced us since they had already met, and her name is Bri.  She’s a photography major and is really nice and we see each other in the halls and on the bus all the time.  She is my friend :) Bri offers to wait for me after the flight with some other SCAD bees she had already met.  There was a total of 11 or 12 of us so we all became pretty close and a tight group of friends.  At baggage claim, I realized I have no idea what my bag looks like.  I don’t have a working phone to call my mom to ask her.  And I have a dozen or so exhausted and annoyed students about to be waiting for me.  Luckily, Steve Jobs thought of the iPhone and I managed to connect to the airport Wifi and text my parents who give me a description of my bag.  Dillon, also a photo major I believe, takes my suitcase for me. Photo majors are super nice apparently.  We get to the shuttle and make our way to campus finally.  Edith, our coordinator, takes us to our rooms and I’m sure I wasn’t the only one that passed out immediately.  And that was my eventful journey to Hong Kong. :)

Gold Coast Residences – The apartments we get to stay in :)

Posted in Stories and Thoughts | 1 Comment »