Have any questions?

+44 (20) 3540 6226

hello@appshed.com

Essentials

Game Config

The most important object in every game is the "gameConfig" object.

Every game MUST have one of these objects.

This is where the main settings for the game are placed. It also holds the code to launch the game.

gameConfig

 

The Action for the gameConfig object holds the code to launch the game.

eval(app.game.run());

gameConfig action

 

For Phaser Developers

This line of JavaScript is essential, and without it the game will not run within AppShed. You can think of it as follows:

Phaser.io on web server:

var game = new Phaser.Game(config);

Phaser in AppShed

eval(app.game.run());

 
 
 

 The Action also has 4 functions:

  • preload()
  • create()
  • update()
  • redmder()

These are the 4 main functions of every Phaser game. In AppShed Game Maker, these functions appear in the gameConfig object.

However, you are not required to put anything into these functions. As shown in the image, they can be empty. Game Maker will add code to these functions behind the scenes every time you add an object to your game.

 

For Phaser Developers

You could put all your JavaScript code into gameConfig, and not add any other objects. Game Maker will run this just like a normal Phaser game.

But Game Maker will also create code behind the scenes for every object you add to your game. e.g. if you add an Image object, Game Maker adds code to the preload() function to load the asset.

Game Maker takes care of many of the "scaffolding" tasks by creating code for you.

 
 
 

 

Visible Objects

Every game will need some visible objects that appear in the game. 

Visible obejcts are any ofthe objects in the "Sprites" group and the "Graphcis" group.

visible objects

 

(If the object is "low-lighted" then it is not currently available. Game Maker is updated regualrly so come back soon to see if these objects have been enabled.)

 

 Properties

If you add a visible object, e.g. a "Sprite", you can set the basic properties.

To see all the properties, you must first Save your object, and then re-open it (click on the object and Edit). This will show the properties.

edit

 

properties

 

 Object Name

The Object Name is an essential field. It is the unique name for this object. 
Game Maker will ensure that the name is unique (by auto-replacing special characters and changing the name if it is a copy of another object name)

The Object Name is a variable name that is available as a "global variable" anywhere in your game. e.g. if you have an object called "sprite1", then you can reference the object by this name in all your JavaScript code. e.g.

console.log(sprite1.width)

 

Variables available in JavaScript

For Visible Objects (such as a sprite) the Action for the Sprite will become part of the create() function. Any code that you write in the JavaScript editor will be run during create().

 spreite action

 

Variables available in the Action

Within the Action (the create() code) you have access to the following variables:

object

"object" is a variable created for this game object, e.g. "sprite1". The variable "object" is just a reference to the current game object. It can be referenced as such e.g.

   console.log(object.width)

<other_game_object>

All other game objects will be available using their unique Object Name.
e.g. "gameConfig" or "collider1" or "audio2" e.g.

     audio2.play()

 

appshed name white text 250

Copyright © 2017 AppShed Limited