Copy link to clipboard
Copied
/* js
var hitBool=true;
var score=0;
var txt = new createjs.Text("Game Over", "20px Arial", "#ff7700");
txt.textBaseline = "middle";
txt.textAlign = "center";
txt.x = stage.canvas.width / 2;
txt.y = stage.canvas.height / 2;
addEventListener('tick', checkCollision);
function checkCollision() {
// test star versus crescent
if (star.hitTest(crescent)) {
if(!hitBool){
hitBool=true;
score=score+1;
txt.text=score.toString();
stage.addChild(txt);
stage.update();
}
} else {
hitBool=false; // <- if you want to allow another hit after a no-hit.
}
}*/
but the code is not working . how can i make createjs text field dynamic for game scoring ? is there any easier way ? in flash we have easier option to create dynamic text field . i want dynamic not displaying text .
// as3 code
var hitBool:Boolean
var score:Number=0;
addEventListener(Event.ENTER_FRAME, checkCollision);
function checkCollision(event:Event) {
// test star versus crescent
if (star.hitTestObject(crescent)) {
if(!hitBool){
hitBool=true;
score=score+1;
text1.text=String(score);
}
} else {
hitBool=false;
}
}
ok. i could do it myself
flash cc export dynamic text automatically for createjs
for more understanding this link
Copy link to clipboard
Copied
ok. i could do it myself
flash cc export dynamic text automatically for createjs
for more understanding this link