Have any questions?

+44 (20) 3540 6226



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.



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


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



 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.)



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.





 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.



Reference Variables available in JavaScript

Within the JavaScript code editor you have access to the following variables:

  • object
  • item
  • data
  • gameConfig *

You can use these variables to make more powerful programs. These variables are called "reference variables" because they point to (or "reference") other objects.

You also have variables for each of the objects that have been added to the game, e.g.

  • image1
  • sprite-abc
  • my_own_function

(These names will be based on the names you have given your objects)

* The "gameConfig" variable is the default name for the Game Config object.

If you changed the name, then use whatever name you chose, e.g. "myGameConfigObject".



"object" is a variable created for the current game object.

For example, if you are editing a Sprite that has the name "sprite1", then the variable "object" is just a reference to this Sprite.


Try it out

  • Create a Sprite.
  • Edit the Action and replace the code with the following snippet:

alert(object.name + ' has been created.');

  • Save the item

As soon as you save the item, you will see the popup alert message:

alert sprite1 created


Why does the alert message appear when you save the item, not when you click "Play Game"?

The reason is that in Game Maker, whenever you save an item, the game is relaunched in the background.
This means that the game is actually running before you click "Play Game". It's just paused in the background.



"item" is a variable created for the current AppShed Item. This is part of app.js. 
For more info, search of "Item Object" in app.js documentation.



"data" is a variable that contains any data properties for the current item.

When you edit the properties of an object, you might see a collection of data properties. These will be available in JavaScript using the "data" object, e.g.:


data variables

If there is no data for a particular object it will look like this:

data variables none



"gameConfig" is a variable that contains all the properties defined in the Game Config object.
This can be very useful in more advanced games when you want to know what the configration of the game is.

For example, to create a rectangle that is half the width and half the height of the game, use:

var rect = this.add.rectangle(160,225, gameConfig.width/2, gameConfig.height/2 , "0x7A7A7A");



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

For example, if you have a Sprite called "sprite1", then you can use the variable in your code like this:

alert(sprite1.name + ' has been created.');


Have you noticed that this code is very similar to the code for "object" above?

In fact, when you are editing sprite1, then the variables "sprite1" and "object" are identical.

It's probably better to use "object" so that if you decide to change the name of the object (e.g. "newSpriteName"), the code does not break. Any code using "sprite1" will not work after you rename it.




   Get In Touch   

appshed name white text 250

Copyright © 2022 AppShed Limited

AppShed Support
Customer Support

We are online and available to help teachers/educators using AppShed. How can we help you today?

Chat, call or email support@appshed.com