$(init); //load in images var s_timer = new image("images/timerPlaceholder.png", 10, 10); //10 subimages, with 10 per row. (So just one row in this example.) var soundsFolder = "sounds"; var sounds = [ "shoot" ]; //List of all sound files as strings (do not include file extension) function init() { Game.initialize(20, 20, 500, 500, 60, gameStart); //Start game engine. Create a window at 20,20, width 500 and height 500, 60 frames per second. As soon as loading is done, it'll call gameStart(). } function gameStart() { GameWindow.backgroundColor = {r:0, g:0, b:0}; Game.setUpdateFunction(update); //Let the game engine know we want to link our 'update()' to the game's update step. GameAudio.init(sounds, soundsFolder); GameObject.create(block, 300, 300); //create an empty block which does nothing } function update() { //You can add code here which will be executed every frame. (recommended to do this in individual objects whenever possible) } var block = { start: function() { this.renderer.image = s_timer; this.renderer.image.subImages = 10; this.renderer.image.subImagesPerRow = 10; }, update: function(deltaTime) { this.renderer.subImage += deltaTime; } }