July 4, 2018 - Cloud Web Designs

Space shooter game

By Karel Jordaan / On

Ok so my second game is almost done and again nothing new or ground breaking but phew! alot of fun to make and learning this new frame work called enchant.js is so much fun and makes scripting games alot easier in many ways.

So the concept for the game quickly in a nutshell is you, the player, being a spaceship that can travel around in space and being confronted with alien ships appearing randomly or flying in from outer space and just minding their own business really, but you having the ability to shoot them to earn points.
I must be honest, the original concept for the game was quite different but as I run into roadblocks and limited knowledge, I find myself having to reshape the original concept that I had for the game into something new , which is not always such a bad thing…
So the approach for scripting this game was using Javascript and the object orietated way of doing things . Creating classes with properties and functions to bring the characters to life on the screen ect ect.

Below is bit of code that basically represents a Class in the Javascript enchant.js framework that contain all the players properties and functions.

Player = Class.create(Sprite, { // declare a custom class called player
initialize:function(playerX,playerY){ // initialize the class (constructor)
Sprite.call(this,16,16); // initialize the sprite
this.image = game.assets['graphic.png']; // set the image
this.x = playerX;
this.y = playerY;
this.frame = 0;
} else if(game.input.right){
} else if (game.input.down){
} else if(game.input.left){

So I will upload a Beta version of the game for you to play a bit by the end of the week and a Beta version basically just means that it’s not the final product but its something playable to try out for now.
Thanks for reading,till later then,cheers.