-
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));
}
Last edited by just_started; 11-28-2008 at 09:28 AM.
-
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?
-
Senior Member
If I got what you mean, you just need to remove these
rotatetext._rotation = Math.random()*360;
to get rid of rotation
-
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.
-
ʞ33ƃ
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|