Hello again. So I just finished my first Project right now, had a lot of difficulty on some parts but I think I managed to get it working.
First, as I am not particularly an artist, I decided to get some assets and edit them in photoshop for this project. I got the character assets from this site:
http://www.spriters-resource.com/snes/supermariobros3/sheet/4296/
this person made a sheet for Mario animation.
Yes, I am trying to make Mario. This will be fun…
Next I got the sound files from youtube:
Classic VGM 100: Super Mario Bros. – Overworld (Main Theme)
Super Mario Bros. 3 Sound Effects
and used Audacity to extract the parts I actually needed.
After all the Photoshop-ing I am ready to work on the actual coding.
On load of the patch, I have a loadbang that creates the window, preload/downloads the images, and loads the sounds. Here is what the loadbang for sound looks like:
You can see that I used relative paths for both of them. This is to make sure the files could be loaded even when the folder is copied to a different computer. Also, loadbang automatically starts and loops the ambient loop, but does not start the jump sound because the jump sound should only play once when the player presses the jump button.
Now, let us look at the jump portion of my code:
At the top, I have a sel object. When the player presses the jump button, a toggle will turn 1. So using the sel object, I can bang only when the player presses the button. Since I only want the jump sound play once for every jump, I have a oneshot object to ensure it only plays once. The counter at the middle starts from 0 goes up to 30 and down back to 0. This value is used to change the y position of the character up and down, as if it were jumping. Once the value goes back down to zero, I send a bang to the clear object at the top which resets the oneshot object so that it could play the jump sound once again.
I wanted the character to have its moving animation whenever the player holds down left or right. This was one of the parts that was slightly challenging because for our previous assignment we only learned how to do oneshot animations and looping animations, not animations that move on keydown and stop on keyup. Here is a small portion of my code:
This code is where I am getting toggles from keypresses of the left and right arrow keys. Whenever they get a 1, they start the metro which is used for starting the animation and for moving the character position either left or right. From some google-ing I figured that I could just stop the metro at any point using the stop object, so whenever the sel is equal to 0 I decided I would send a stop to the metro. This worked fine.
At this point I only had 1 background with the character moving back and forth through the screen. This was fine, but I wanted the background to change once in a while. Here is how I did it:
When going off screen either left or right, I kept track of the number of times the player did that. From that value, I used the mod object so that a number between 0 and 2 gets output. Finally, I used a sel object to hide/unhide the corresponding background image (here I have 3, hence I used mod 3). Going right I basically kept adding to the sum, and going left I subtracted from the sum value.
Once all of this is done, making the controller is quite easy. Four buttons and an “Earth” and done!
And here is the demo video of the actual thing:
Thanks for reading!
Was it your intention to have him roll from side to side like that?
Thank you Alex for your comment.
Actually, I did originally think of making him simply do the normal walk animation at first.
However, my roommate said that will be too normal and boring and gave me the idea of making him roll. At that point I wasn’t that interested in what mario was doing because I was focused on making the patch work.
As a result, it was actually a good idea that I made him roll because if I wanted him to do the walk animation, every time the player presses the opposite direction, I would need to change the animation frames to something else (or simply flip the frames) but that did not really work the way I wanted to. Making him roll like in the video was very convenient in that I just need to change the animation direction (instead of counting the frames from 1- 7, do 7-1) which I could easily do with the counter object.
I think this is amazing that you made this feel like the authentic game from scratch. The scenery and the music all blends perfectly with the sprite. It even makes the jumping sounds like mario. The flow through all the animations feels continuous and complete. It’s easy to see the amount of effort you put into making this perfect.
Thank you very much! Since I had time between Thursday’s class and Monday, I actually added a coin object to this. Please look forward to my presentation tomorrow in class 😀
I really liked the way you emulated a NES controller (I’m guessing with what you were going for) with your drawing!
Thanks Sam!
Yes, I was going for the NES controller (but I did not draw the up or down arrows because it didn’t have that much functionality),
Awesome project; I really liked the coin feature that you added in afterwards. I feel like you should do another video upload to show it off to future classes!
Thanks! Yeah, I might actually do another video upload in my free time. 🙂
I think your project is far beyond what anyone expected and it is amazing! However, my one suggestion that you may have considered is to scale mario to the scenery. I think by making him smaller it will look more realistic and it might make him look less pixelated.
Thank you very much! Ah, I see, yeah I might actually take a look at the actual mario games and scale him correctly. Thanks for the advice!
I really like how you mimicked the game and stayed true to Mario. I also enjoyed how you made a game out of your animation.
Thanks! 🙂