SimpleSampleSeries もぐらたたき


◆もぐらをクリックするとスコアが増えます。 That's all.
◆お持ち帰り用 mole.fla

-----------------------------------------------------------------------------------------

// 一定時間でモグラが動く
var timer:Timer = new Timer(800,0);
timer.addEventListener(TimerEvent.TIMER,moveMole);
timer.start();
function moveMole(event:TimerEvent):void
{
	this.mole.x = Math.random() * 300;
	this.mole.y = Math.random() * 200 + 35;
}

// モグラをしばく
this.stage.addEventListener(MouseEvent.CLICK,bashMole);
function bashMole(event:MouseEvent):void
{
	if (this.mole.hitTestPoint(this.mouseX, this.mouseY, true))
	{
		this.score.text = String(int(this.score.text) + 100);
	}
}

-----------------------------------------------------------------------------------------

Copyright © 2008-2017 Nekorald All rights reserved.