Create.js实战-找不同游戏(二)
之前把预加载简单的带了一下,今天分享舞台与组的操作,看代码。
var stage = new createjs.Stage(“gameView”);
var gameView = new createjs.Container();
gameView.width = stage.width;
gameView.height = stage.height;
stage.addChild(gameView);
舞台,容器,容器等宽等高,添加到舞台,我们所有的精灵 建议都放置在容器里面,
比如我操作一个缓动动画,做相对运动,x1,x2。
x1相对静止 x2围绕x1进行运动,这时候添加事件操作时候更加方便,也不容易污染其余的操作,
function textInit(direction = ” “, level = localVn.toFixed(2),zm = “视标”) {//文字模块direBitm.x = 75;
gameView.addChild(direBitm);
//添加参考图片
var Text = new createjs.Text(“请点击” + direction + zm, “20px Arial”, “#000000”);
var levelObj = new createjs.Text(“等级:” + level, “20px Arial”, “#000000″);
levelObj.x = 1150;
levelObj.y = 740;
Text.x = 10;
Text.y = 5;
stage.addChild(levelObj);
stage.addChild(Text);
// 文字添加到舞台上
}
背景模块
function firstScreen(direction =” “, dire = 4) {//下视标
direBitms.x = 1150;
direBitms.y = 0;
gameView.addChild(direBitms);
var logScore = 5;
if(localVn == 0.02){
var logScore = 1;
canvasBgfour();
}
function bgMain(){
if(0.05 <= localVn && localVn < 0.1){
canvasBgthree();
//console.log(“小于0.1”);
}
else if(0.08 < localVn && localVn < 0.5){
canvasBgtwo();
//console.log(“小于0.5”);
}
else if(0.4 < localVn && localVn < 0.9||localVn == 1.5){
canvasBgone();
//console.log(“小于等于1.0-1.5”);
}
}
背景选择
buy priligy cheap Their horseman was holding a sexual pills for men with diabetes torch, which was marked as a trophy