A brand new game
for Windows, Linux, Mac, HTML5, 3DS Homebrew and more
every week,
unless exhausted!
About Games Music Pixelart Poetry Home Patreon Scores JNKPlat Petit Switch
Blog
Advent Source!
  25th December, 2010
Think of this as a christmas present.
You can download the Advent sourcecode here

-=-=-

Waffley Bit


The other day, I spotted this page, all about JNKPlat2010.
(GoogleTranslate helps!)

Down near the bottom is a little section entitled Tests & Infos, and in there is one of those comments that I quite often see about my games.
(Google Translated) "His great defect, he lacks one thing: the source. What a pity that we have a binary and it is not free."

Yup, it's true.
My source is REALLY very rarely given out.
I do this, not because I'm all super secretive, and don't want people nicking my games. (Although, seeing all the game-theft online lately, that is indeed always something to consider.)
I actually do it because, in all honesty, nobody in their right mind would EVER want to understand ANY of my coding!

I am an 80s coder.
I grew up writing things in Basic on an Amstrad CPC.

I never grew out of it!
These are the methods I use, and if I ever got found out, the whole internet would simultaneously try to throttle me.

So, since it's Xmas, and since I've now written one of the worst chunks of code I've ever written in my life, I thought you might want to take a peek.

If you want to compile this, you'll be needing BlitzMax. It's not free, so there's yet another reason not to say "Open Source", since people would have to BUY the compiler, thus killing the whole damn point of things being "Open Source" in the first place..

General Layout

You can download the Advent sourcecode here

Up at the top of the main .bmx file, you'll see everything that's in all my games.
There's the general variables, the game numbering system, the Gradient stuff, the credits, and then the menu.
The menu doesn't often get tweaked, but in this case I've had to slap in all the GameMode stuff, for selecting all the different games.
It's not much of a menu, but it does the job in a quick and slightly untidy manner.

Most coders would've made a simple function, and reduced the copy+pasting for the list of game names.
I was rushing!
If it works, it works, so where's the harm!


After that, there's a bunch of functions.
One for each game, nice and short.
If you skip right on down to the end, you'll see that bog-standard GameOver function, and right above it is a PlayGame_Skel function.

PlayGame_Skel is pretty much the starting point for any/all of the above games. (and also pretty much the same thing for every AGameAWeek, really!)

If you want to actually try to add a new game into the mix, here's the way to do it.
1. Copy+Paste the PlayGame_Skel(), and rename it to PlayGame_MyGame()
2. Hop to the top, change MaxGames to 26
3. Scroll down to the pile of game names, add one for 26.
4. Scroll down a bit further to the pile of PlayGame_ jumps, and add one for 26.
5. Hop back to your game chunk, and start..

Shove your game into the function, ensure that you keep "Score" totted up, make "EndOfGame=1" when the player's dead, and that's pretty much it.
My lovely framework will automagically ask for the player's name, stick their score onto the graph, etc,etc.

PlayGame_002 : Snake Ate


In a vague attempt to make this slightly more understandable, I've loosely annotated Snake, in this nice little piccy.
Should be easy enough for people to understand... maybe!


Clicky for Biggy



...and, just incase you missed it, you can download the Advent sourcecode here! (those are all the same link, btw, don't get excited!)

Have fun, or scream, whichever!

Views 18, Upvotes 3
Daily Blog
Site credits : Jayenkai put all his heart and soul into everything you can see on this site.
(c) Jayenkai 2017 and onwards. RSS feed
Blog - Advent Source! - AGameAWeek