Class: Backdrop

PlayScene.Backdrop(scene)

- This sets up, creates, and updates the environment for the game. This class is used to create, manage, and manipulate the environment for the game.

Constructor

new Backdrop(scene)

This will set up all the default values for the class variables
Parameters:
Name Type Description
scene the current Scene game object
Author:
  • Christian P. Auman
Source:

Methods

create()

This calls the needed create/setup methods and also creates a moon image and centers it accordingly
Source:

createCityscape()

This will create tileSprites for the buildings, the trees, and the background. Allows for repeating the image and the illusion of infinite images
Source:

createStars()

This is an algorithm that is based off of my cloud algorithm, and at the start of the game will create a new renderTexture and will draw stars based on a given grid parameter
Source:

preload()

This function is called before anything is drawn on the canvas. This allows for asset preloading which prevents anything from drawing without it first loading the asset.
Source:

resetG()

called whenever the game needs to be reset
Source:

setPosition(x, y)

this method will set the class position x and y values to the given x and y parameter values
Parameters:
Name Type Description
x x pos
y y pos
Source:

startG()

Called at the start of the game
Source:

stopG()

called at the end of the game
Source:

update()

This will be updating the tile position for the cityscape if the state is not PAUSED
Source:

updatePosition()

This will update every game object accordingly using the given class position variable
Source:

updateTilePositions()

This method will update the tile's x position for the trees, buildings, and background. Depending on how big the number added to the x value is, will determine how fast they move.
Source: