ever wonder how to make a throwing game or track the speed of the mouse??
i diddnt see a tutorial on this,so im writing up my own :D
to start off make an _x array and a _y array
so you should have somthing like this in the frame
xar = new Array()
yar = new Array()
now what you need to do is create a variable to increase every frame,like this
var i:Number=0
so now we will increase that every frame like this
onEnterFrame=function(){
i++
}
now we will start with the xmouse
onEnterFrame=function(){
i++
xar[i]=_xmouse
xx=xar[i]-xar[i-1]
}
now,all this does is,add a value to xar
our _xmouse variable
every frame then it gets the distance between that value and the previouse value
sofar we have this
xar = new Array()
yar = new Array()
var i:Number=0
onEnterFrame=function(){
i++
xar[i]=_xmouse
xx=xar[i]-xar[i-1]
}
and for the _ymouse values just add
yar[i]=_ymouse
yy=yar[i]-yar[i-1]
and that does the same thing but with the _ymouse
now are compleate code is
xar = new Array();
yar = new Array();
var i:Number = 0;
onEnterFrame = function () {
i++;
xar[i] = _xmouse;
xx = xar[i]-xar[i-1];
yar[i] = _ymouse;
yy = yar[i]-yar[i-1];
};
see,this is useful beacuse with this you can
throw objects
slide objects
and other cool stuff
example:
http://denvish.net/ulf/220407/77642_throw.fla
http://denvish.net/ulf/220407/77666_throw.php
the fla and the swf
feel free to use the code as shown