ActionScript 3

Soldato
Joined
19 Jun 2009
Posts
5,983
Location
London
So basically I am creating a mobile game for android in Flash CS5.5 using AS3 and the idea is the user has to click on randomly appearing objects in order to gain/lose points.

I've managed to get the object to move randomly across the screen, but does anyone know how to control the speed at which it keeps moving? As of now the speed is quite eratic and impossible to click.

This is the code I have within the class at the moment:

package {

import flash.display.MovieClip;
import flash.events.Event;


public class ufo extends MovieClip {

public function ufo() {
addEventListener(Event.ENTER_FRAME, pulse);

}

function pulse(evt:Event)
{
this.x = Math.random() * stage.stageWidth;
this.y = Math.random() * stage.stageHeight;
}
}

}

Any advice would be appreciated. Thanks
 
Back
Top Bottom