Hello!
I want to have a ball, that will follow the mouse a little… The ball will only follow the x way but i cant get it working. I have this code on the frame:
this.onEnterFrame=function(){
controlX=_xmouse*2-(x1+x2)/2;
move();{
_root.ball(controlX, 176.8)
}
}
I have no idea if this one is right in anyway… but no error atleast.
The ball have the instance name “ball”.
I also want that the ball will rotate how longer it is at the x way, so it will rotate as much as _xmouse.
Can someone change the code so it will work?
try this:
ball.onMouseMove = function() {
this._x = _xmouse/2; //2 is how much you want it to follow by
this._rotation = _xmouse;
}
try that, lemme know how it works.
:p:
bodyvisual:
try this:
ball.onMouseMove = function() {
this._x = _xmouse/2; //2 is how much you want it to follow by
this._rotation = _xmouse;
}
try that, lemme know how it works.
:p:
Thanks !
it works great, i only needed to change one thing on the mc
This is my code now
ball.onMouseMove = function() {
this._x = _xmouse/4;
this._rotation = 1.2*_xmouse;
}
but… the ball start on x=0… can i do anything to change that? And is it hard to add so the ball smoothly will stop?
right before the first line do this:
ball._x = 30; //30 is your x position.
if you want to have it on a certain y, put this, as well as the above:
ball._y = 30; //30 is your y position.
hope that helps ya!
:p:
bodyvisual:
right before the first line do this:
ball._x = 30; //30 is your x position.
if you want to have it on a certain y, put this, as well as the above:
ball._y = 30; //30 is your y position.
hope that helps ya!
:p:
hm… it dont work It is on X=0 yet
i got it working
i had to do this:
this._x = 243.8+_xmouse/4;
now it works
But can someone tell me how to do it so it will smoothly stop ?