# Need help for animation in typing game

• 11-28-2008, 09:25 AM
just_started
Need help for animation in typing game
Hello Seniors,

I am posting this again and I hope I will get some guidance from you people. I am trying to develop a dynamic typing game. Below is the code I found from somewhere. It takes the movieclip on the stage from different directions. The problem with this code is that each time it brings the movieclip on the stage it changes its angle. I only need to bring the movieclip from different directions (I will put the text in these movieclips)

onEnterFrame = function(){
moveBox(box);}
function moveBox(rotatetext){
var speed:Number = 15;
if (rotatetext._x >= Stage.width+15) {
rotatetext._x = -10;
rotatetext._rotation = Math.random()*360;
}
if (rotatetext._x <= -15) {
rotatetext._x = 560;
rotatetext._rotation = Math.random()*360;
}
if (rotatetext._y <-20) {
rotatetext._y = Stage.height+20;
rotatetext._rotation = Math.random()*360;
}
if (rotatetext._y >= Stage.height+15) {
rotatetext._y = -15;
rotatetext._rotation = Math.random()*360;
}
rotatetext._x += speed//* Math.sin(rotatetext._rotation*(Math.PI/180));
rotatetext._y += speed//* Math.cos(rotatetext._rotation*(Math.PI/180));
}
• 11-28-2008, 09:49 AM
renderhjs
the probem or discription is not clear,
what do you mean by "bring"? - perhaps moving?
in order to move a different path you need a different direction so what is your problem?
• 11-28-2008, 10:23 AM
hatu
If I got what you mean, you just need to remove these
rotatetext._rotation = Math.random()*360;
to get rid of rotation
• 11-28-2008, 10:48 AM
just_started
Thanks alot bro,

I followed the instructions of hatu and removed the following line
rotatetext._rotation = Math.random()*360;
its working fine as I wanted to enter the movieclip on the stage with different x and y each time.
Thanks again bro.
• 11-28-2008, 12:08 PM
xMCNUGGETx
Looks like as2. Lee has a good tutorial on using the built in Tweener class. There are plenty of other tweening classes, but this is a good starting point. I would suggest using one of these classes vs animating it yourself using an enterframe.

http://gotoandlearn.com/play?id=53