var deger:String = "";
stage.addEventListener(Event.ENTER_FRAME,git);
function git(e:Event):void
{
if (deger=="yukari")
{
topmc.y -= 1;
}
if (deger=="asagi")
{
topmc.y += 1;
}
if (deger=="sol")
{
topmc.x -= 1;
}
if (deger=="sag")
{
topmc.x += 1;
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN,yonbul);
function yonbul(e:KeyboardEvent):void
{
if (e.keyCode == Keyboard.UP)
{
deger = "yukari";
}
if (e.keyCode == Keyboard.DOWN)
{
deger = "asagi";
}
if (e.keyCode == Keyboard.LEFT)
{
deger = "sol";
}
if (e.keyCode == Keyboard.RIGHT)
{
deger = "sag";
}
}
Hiç yorum yok :
Yorum Gönder