logo
Search:

Login:


Forgot Details? Sign-up

forum >> Programming questions >> Game Development

ch7 of HTML5 game development: sizing leaves.png

Posted Nov 05 2013 at 10:12 AM by
Eugene Ruthven (eugene)
Been going thru Chapter 7 and running the examples. Thank you very much it has given a focus on learning this stuff.

However, when it came to leaves.png it was not being sized to fill the canvas area.
leaves = new Sprite(scene, "leaves.png", 640, 480)
would leave a chunk in the lower right uncovered.
by using:
leaves = new Sprite(scene, "leaves.png", scene.width, scene.height)
leaves.setPosition(scene.width/2, scene.height/2)
I got the background to fill the canvas area and positioned correctly.
In the source code of your online frogFly.html version you have 800 for scene.width and 600 for scene.height and that looks ok plus the additional setPosition line.
None Found
AuthorMessage