Loading and placing graphic resources
You need to build the game over the blueprint created in the first chapter, so here is the content of the assets
folder:
You can see the spaceship, the asteroid you have to avoid, a small circle to create particle effects, and the scrolling background.
You will spend some time trying to understand the background. As the game is 480 x 320 pixels, your background should be at least 480*2=960 pixels wide, which is made by two 480 x 320 seamless images.
With the following image, you will be able to give the player the possibility to fly through an endless cityscape:
All these images need to be preloaded by the loadassets.js
file located in
src
, which will become:
var gameResources = ["assets/background.png","assets/ship.png","assets/particle.png","assets/asteroid.png"];
You also need to make some changes to main.js
because this time you want a game in the landscape mode:
cc.game.onStart = function(){
cc.view.setDesignResolutionSize...