Making a Game

Creating a game is simple:

  1. You create and load in a bunch of resources.
  2. You create a bunch of scripts that access these resources.
  3. Magic happens.
Scripts themselves are simple and are split into two categories:



Map Scripts:

A map script is called when your game first starts it takes care of loading resources, and monitoring various game attributes. Like other scripts in Hack Wars it does this based on entry points it has three:

Initialize:

This is called when a level first loads, and is mainly used for initializing your level, so:
  • Loading in sprites using createSprite().
  • Setting global variables.
  • Positioning the screen using setViewportX() and setViewportY() to the appropriate location etc...

Continue:

Continue is called at a rate of 20FPS. You can use this block of code to: draw a HUD, monitor global variables, take keyboard input, etc. Do not control sprite variables here, we will get to this.

Finalize

Called when your script is shutdown, used for saving etc, not yet implemented.



Sprite Scripts:

A sprite itself, once created, can be thought of a single object with many variables attached to it... these can mostly be changed on the fly using the API. createSprite() returns an integer ID which from that point forward can also be used to refer to the sprite. A sprite has:
  • A global x and y position based on the maps coordinate system.
  • An 8 frame image which is rendered, and can be changed.
  • A script that runs at a rate of 20FPS, and can be changed.
  • An animation variable which indicates which frame of the image should be rendered.
  • Local variables for keeping track of other attributes you set.
  • Probably several other things I'm forgetting.
The actual script you set for the sprite has only one entry point fire and in this script you perform actions like moving the sprite, checking collision detection (which is done for you via collision messages), Perform animation (by advancing frames), and any number of other things.

Some Concluding Thoughts:

Making a game in Hacktendo isn't for the feint hearted, it takes hard work, and some knowledge of programming. We are going to work on tutorials, and on other GUIs for making the game creation easier. This having been said, the best way to get going with the Hacktendo game creation process is by talking with fellow players, and starting to get a community going. I hope to see some awesome games real soon.