Started building the main menu
- the inertia works
- need to import path or create one in flash
- need to figure out how to make the triangle floater move on a path.
Menu code with x and y positions for the floater_mc
//inertia = (destination - location) / constant;
var c:int = 5;
var dx:int = sutras.x;
var dy:int = sutras.y;
var lx:int;
var ly:int;
about.addEventListener(MouseEvent.MOUSE_UP, goMenu);
history.addEventListener(MouseEvent.MOUSE_UP, goMenu);
sutras.addEventListener(MouseEvent.MOUSE_UP, goMenu);
tutorials.addEventListener(MouseEvent.MOUSE_UP, goMenu);
quiz.addEventListener(MouseEvent.MOUSE_UP, goMenu);
floater_mc.addEventListener(Event.ENTER_FRAME, moveMe);
function goMenu(e:MouseEvent):void{
dx = e.target.x;
dy = e.target.y;
//trace("My name = " + e.target.name);
}
function moveMe(e:Event):void{
lx = e.target.x;
ly = e.target.y;
e.target.x += (dx - lx) / c;
e.target.y += (dy - ly) / c;
//e.target.rotation += 0.5;
//trace(e.target.y);
}
var c:int = 5;
var dx:int = sutras.x;
var dy:int = sutras.y;
var lx:int;
var ly:int;
about.addEventListener(MouseEvent.MOUSE_UP, goMenu);
history.addEventListener(MouseEvent.MOUSE_UP, goMenu);
sutras.addEventListener(MouseEvent.MOUSE_UP, goMenu);
tutorials.addEventListener(MouseEvent.MOUSE_UP, goMenu);
quiz.addEventListener(MouseEvent.MOUSE_UP, goMenu);
floater_mc.addEventListener(Event.ENTER_FRAME, moveMe);
function goMenu(e:MouseEvent):void{
dx = e.target.x;
dy = e.target.y;
//trace("My name = " + e.target.name);
}
function moveMe(e:Event):void{
lx = e.target.x;
ly = e.target.y;
e.target.x += (dx - lx) / c;
e.target.y += (dy - ly) / c;
//e.target.rotation += 0.5;
//trace(e.target.y);
}
No comments:
Post a Comment