As the title says…
Lets think about this, i seen some tutorials, but lil confused upon them.
Lets take example, We want to move the our player Upwards.
(“here’s a working code”)… But you gotta continue to click click click, or roll off roll on
and the player will move, i promise…
the deal is, who the hell wants to do that???
so heres the code…
Button.as
package {
import Engine;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import Ship;
import flash.display.Stage;
import flash.events.TouchEvent;
public class button2 extends MovieClip {
private var stageRef:Stage;
private var ship:Ship;
public function button2(stageRef:Stage,shipmc:Ship)
{
ship = shipmc;
btn3.addEventListener(MouseEvent.CLICK,move1);
}
private function move1(ent:MouseEvent):void
{
ship.moveUp();
}
}
}
Player.as
package
{
import flash.events.Event;
import flash.display.MovieClip;
import flash.display.Stage;
import Engine;
import buttons;
import Missile;
public class Ship extends MovieClip
{
//Set our Var.
private var stageRef:Stage;
private var speed:Number = 5;
public function Ship(stageRef:Stage)
{
// constructor code
this.stageRef = stageRef;
}
public function Shoot()
{
trace("shoot");
stageRef.addChild(new Missile(stageRef, x+ 1, y - 10));
}
public function moveUp()
{
trace ("moving upward");
this.y -=speed;
}
}
}
[COLOR=#ff0000]Note this is just my practice engine, where i test things, and try new things. (not an actual game or play).
Now, lets think… What can we do, to continue this mouse down / click… (doubtfully use click). .roll over maybe… … but we want that player to continue to move with out moves up 1 …click again moves up 1… yuck… thats pathetic… so any takers or ideas
Thanks,
TalonStart
[/COLOR][COLOR=#000000][/COLOR]