Last active
August 29, 2015 14:14
-
-
Save ashimaathri/961822c4a6aa8da05cf4 to your computer and use it in GitHub Desktop.
Step 2 of VTHacks Angry Bird Tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var game, createRenderer; | |
createRenderer = function (width, height) { | |
return Physics.renderer('canvas', { | |
el: 'my-game', | |
width: width, | |
height: height, | |
meta: false, | |
autoResize: false, | |
styles: { | |
'rectangle': { | |
strokeStyle: '#000000', | |
lineWidth: 1, | |
fillStyle: '#000000' | |
} | |
} | |
}); | |
}; | |
game = function (world) { | |
var screenWidth, screenHeight; | |
// Get the dimensions of the screen | |
screenWidth = window.innerWidth; | |
screenHeight = window.innerHeight/2; | |
// Setup the rendering process | |
world.add(createRenderer(screenWidth, screenHeight)); | |
// On every step of the world, render the new state of the world | |
world.on('step', function () { | |
world.render(); | |
}); | |
}; | |
Physics(game); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment