OK, folk are getting intrigued as to how all of this is working, and how nice the Monkey language is to work with, so in the spirit of not being a complete and total git, here’s the complete everything that there is so far..
Included : All assets required for it to work!
Download, open the .monkey, hit F5!
I’ve also left the html5 build intact, so you can give it a little run if you don’t have Monkey installed. (I think!)
Should be as simple as going into the .build folder, then the html5 one, then opening the html file.
… it *should* open up, but no guarantees!!
This has been written by me!
It is EXTREMELY OLDSKOOL!
It is ALL written inside a single file.
It is ALL written inside a single CLASS!
It’s a fucking mess, by anyone’s standards.
… it works, though..
If you’ve never tried Monkey, and want to have a play about with it, you can download The Monkey HTML Demo, to try out everything in it’s HTML5 target. It works really well, and gives you time to play about with the language before deciding to go further, and purchase the full version. The full version lets you target iOS, Android, Windows, Mac, Linux, and more!
Top bit is Variables. You’ll want to fiddle around with these, and add more variables for your game.
Middle bit is Framework. Probably best not to tweak this stuff, unless you want to fix up my quirks, or change the Menu layout.
Bottom bit is Game. You’ll see it.. it’s the bottom bit! Cut out the silly random sprite stuff, and you can plop your own game in there.
Feel free to use anything included in the framework.
If all you want is the dpad sprites, then go ahead and use ‘em.
If you want to use the entire framework, then by all means go for it.
Stick my name somewhere, nice, and Karma will give you a pat on the head!
What IS included
1. Resolution Handler
Copes with whatever resolution gets thrown at it.
2. Image loader
Loads one of three images depending on the current resolution. either “Image”.png, “Image”-hd.png or “Image”-hd2.png
Automagically recalibrates it’s image width and height to handle sprites accurately.
3. Bitmap Font shitz
Lazily uses Monospaced fonts because I couldn’t be arsed figuring out a quick and easy way to handle all the data without pissing around with extra gubbins.
4. Sprite functions
Does bog-standard sprite functions.
Scales everything according to the resolution, and aspect ratio.
Will draw anything between 0,0 and jscrw,jscrh, with jscrw being the right hand side of the screen, and jscrh being the bottom.
SetRot(angle) and SetSize(width multiplier, height multiplier) are your fun functions, SetCol(red,green,blue,alpha) for colourising, and then DrawImg(image,x,y,frame) to draw.
ResetDraw() resets all the stuff to default.
5. Sound function
Really simplistic, and I’ve not tackled the music yet, but you can basically LoadSFX(1), then PlaySFX(1,Pitch,Volume,Pan).
Yeah, that’s pretty much all you need, really!!
6. Scoreboard handling
Copes with multiple GameType scoreboards, so you have one for each difficulty, on the default menu.
You can add more, if required, there’s a bunch of const’s at the top of the script for that, and then you’ll need to tweak the menu code by hand, ‘cos I was too lazy to automate it!
All scores are loaded and saved automagically.
Just update the Score variable, and the framework will do the rest.
If the resolution changes, the engine reloads all your sprites and sounds, ‘cos … well.. things can go horribly wrong if it doesn’t! Plus, it might want to reload different resolution assets, so it can do that, too.
8. Settings and Badges
Set[0-24] (Int) are loaded and saved, feel free to use them as you need.
Set is the audio option. Don’t ask why it’s 5.. it just is!!
Set and  are for the onscreen DPad settings.
Badge[0..127] (Bool) are your badges. Turn them on with GiveBadge(x), as the player get’s ‘em!
Turn it on, at the top of the script, and J_AX and J_AY will (*should!) give you -1 to 1 values for the accelerometer.
The player can tap the icon on the bottom left to reset the accelerometer to 0.
10. Onscreen DPad
If enabled in the script, the onscreen touch controls will appear ingame, and during the pause menu.
Also during the pause menu, you can move the dpad about, with the adjacent buttons mirroring it’s position.
Multi-touch users can also resize the dpad.
Position and size are saved!
Although I’ve only tested this on my iPad, (too lazy to pair the bluetooth to anything else!) this should also work for anything else that an iCade can connect to, so if you switch it on in the script, it’ll be there for every device you can target.
Once turned on, iCade overrides most keyboard controls, switches off onscreen dpad, and disables accelerometer. Blimey!!
12. Other graphicy stuffs
Line(x1,y1,x2,y2), Rect(x,y,w,h) and Oval(x,y,w,h) are in there, as is Text(x,y,txt$,centerX,centerY)
Button(image,x,y,frame) is handy for making sprites into buttons, basically you change it from DrawImg to Button, and it becomes a freakin’ button. Can’t argue with that!
Touch(x,y,w,h) is similarly a tap-able rectangle created for laziness.
All of the above take recent SetCol, SetRot and SetSize changes into account.
JNKrunch$(txt$) returns a compressed string.
JuNKrunch$(txt$) uncompresses it.
Useful for compressing level data, but only if you’ve got ascii-readable text data!
14. Holding screen
If you’re targetting Flash or HTML, the engine will wait at 6fps, until the player’s clicked the AGameAWeek logo before it starts, at which point it speeds up to 60fps, and starts loading.
15. HTML5 Text Cheat
Since text is a lot of sprites, and the HTML5 target is a bit shit at recolouring, any and all text is reset to 255,255,255 before drawing.
What ISN’T included
I think I may be scared to touch this, after previous GameCenter related insanity!!
2. Camera Scaling/Rotation
The inbuilt “rotation” rotates via the top left of the screen, which just ain’t good at all!
I’ve not got around to sorting out my own, and since I couldn’t be bothered with the rotation, I also couldn’t be bothered with the scaling!!
I just haven’t got round to it, yet.
I’m thinking it’ll probably just be an mp3 player, or something, since I’m struggling to figure out how to easily store the music data for my Pseudo Random Music Engine thing.
4. Device Orientation
For Android and iOS, I haven’t yet figured out how to set them to Landscape. That’s not something that can be done in-language, though, and will require external tweaking.
Oh dear god, the bloody icons again..
Here comes 67,000 versions of the exact same image, but at different resolutions, and ever-so-slightly different filenames!!
6. Gamepad Hat
Although my Xbox controller seems to work in the glfw target, the dpad doesn’t. Not sure why. Will have to experiment!
7. Badge Descriptions
Although the engine copes with “Badge Name|Badge Description” values, it doesn’t actually display the description anywhere. Need to figure out an easy way to do that without using up too many sprites for the text..
My WordList engine has been a staple of my frameworks since the DS. I really should get around to adding this!
9. Music STOP on iOS
When the app is run on iOS, it stops background music from playing. I should stop it from doing that!
10. Delta Timing
I can’t be arsed!
It’d be nice to have the agameaweek.com and monkeycoder.co.nz links be actual clickable links. I’ll have to look into that.
Definitely need to add these somewhere, but must also stick to the sprite limit.. tricky..
Um.. I think that’s everything important, anyway!
Insert Feedback Below!
I forgot to mention PlayKey!
No point having an onscreen dpad if you can’t use it!!
PlayKey(0) is up, (8) is down, (3) is left, (5) is right
(10)-(13) are buttons, only 10 and 11 are drawn by default.
These work for the onscreen dpad and buttons, and also cursor keys and ZXCV. Shift and Space and Enter are also in there, too.
WASD and J/K/L/I also work as buttons
PlayKey(99) is the Escape Key.
iCade, when enabled, also works here, too.
If a gamepad is plugged in, and you’re targetting Windows exes (this is all I’ve tested it on!) the left thumbstick does directions and ABXY does the buttons. Start = PlayKey(99), same as Escape
Basically, if you use PlayKey(), you pretty much get a bucketload of control schemes all working nicely together.