【WoofJS】クリックゲーム
Play demo
サンプルコード
setBackdropURL("./docs/images/snow.jpg")
setBackdropStyle("cover")
var circle = new Circle({
radius: random(20,80),
color:randomColor(),
x:randomX(),
y:randomY()
})
var timer=22;
var timerText = new Text({
text:()=>timer,
size:62,
color:"#ffffff",
textAlign:"center",
x:0,
y:maxY-40
})
var score=0;
var scoreText = new Text({
text:()=>'Score:'+ score,
size: 48,
color:"#006400",
textAlign:"center",
x: maxX-170,
y: minY+50
})
every(1,'second',() => {
if(timer===0){
freeze();
}
else{timer--;
}
})
circle.onMouseDown(()=> {
circle.x = randomX();
circle.y = randomY();
circle.color =randomColor();
circle.radius=random(20,80);
score++
})
この記事が気に入ったらサポートをしてみませんか?