First things first – the game
We are making a little game just to test our virtual pads: a landscape game with a shopping cart surrounded by falling bombs and strawberries trying to catch strawberries while avoiding bombs? Does it sound crazy? It is.
This is the content of our assets
folder:
The making of the entire game is very similar to the making of the endless space runner, so there's no need to talk about code you should already know.
This is the content of main.js
:
cc.game.onStart = function(){ var screenSize = cc.view.getFrameSize(); cc.view.setDesignResolutionSize(480, 320, cc.ResolutionPolicy.SHOW_ALL); cc.LoaderScene.preload(gameResources, function () { cc.director.runScene(new gameScene()); }, this); }; cc.game.run();
Just look at the resolution policy to make the game work in landscape mode.
This is the content of loadassets.js
:
var gameResources = [ "assets/bomb.png", "assets/cart.png", "assets/strawberry.png", "assets/leftbutton.png", "assets/rightbutton.png...