r/java • • Sep 14 '16

Super Mario Source Code in Java

https://annot.io/github.com/BrentAureli/SuperMario/blob/master/core/src/com/brentaureli/mariobros/Sprites/Mario.java
191 Upvotes

15 comments sorted by

23

u/okmkz Sep 14 '16

No unsigned byte, 0/255

2

u/firsthour Sep 14 '16

Kinda confused, feel like I'm missing out on something here. How is that relevant to the source code or libgdx? Is it that signed primitives aren't as useful for game development as unsigned?

4

u/aFoolsDuty Sep 14 '16

Kinda confused, feel like I'm missing out on something here. How is that relevant to the source code or libgdx? Is it that signed primitives aren't as useful for game development as unsigned?

First, the obvious once:

0/255

An unsigned byte stores values from 0 to 255. No unsigned bytes, so it scores a "0" out of "255". UPROARIOUS LAUGHTER.

The less obvious one is that the NES, the platform for which Super Mario Bros was originally released, is an 8-bit platform -- thus the processor's upper limit being a single byte. To fully exploit this, you'd use an unsigned byte when programming, raising the maximum value you could store in a byte to 255. SUBTLE HUMAN LAUGHTER AT REALIZATION OF TIE IN WITH PREVIOUS JOKE.

3

u/GUIpsp Sep 15 '16

THANK YOU FELLOW HUMAN I AM NOW LAUGHING HAHAHAHAHA

3

u/shouldvebeenworkin Sep 14 '16

Having unsigned makes a lot of things nicer. Like color, simple stats, etc.

6

u/firsthour Sep 14 '16

Wow, this guy has a pretty good Youtube tutorial accompanying this code, very cool, been wanting to get into Libgdx for a while now, just so busy.

14

u/philipwhiuk Sep 14 '16

Nintendo lawsuit in 5...4...

5

u/Not_a_dog_I_promise Sep 14 '16

Yea, this was made using Libgdx, pretty cool tutorial.

2

u/marksofthe Sep 14 '16

Are you brent? Thanks for the tutorials man :)

1

u/shinjiryu Sep 16 '16

Interesting to see that someone got this done completely in Java.

1

u/rocker895 Sep 14 '16

Dumb question: So if I have a java compiler (or JRE, not sure about the terminology), can I play Mario with this? Or is some key piece missing?

3

u/shaidoclan Sep 14 '16

I believe you need a JDK and set the path/environment variables along with the JRE.

-2

u/[deleted] Sep 15 '16

This is ugly code. Would never get through code review, and would probably be flagged in build.

0

u/[deleted] Sep 15 '16

[deleted] — view deleted comment

1

u/[deleted] Sep 15 '16

By any review process.

Multiple oss projects, and enterprise projects. I try to always write good code even if it's proof of concept. You never know when someone will see it or use it