[quote=ArmoredSandwich;2326509]How can you not figure this out if you have been doing flash for 4 years? I guess you spend most of that time on animation then XD
Anyways, for the moving part a simple solution would be: would let every enemy pick a random location in the field, move there, and when it has reached that destination, repeat.
Anyways, the moving part could be simple solution. Let every enemy pick a location, let every enemy move to that location, when an enemy reaches that location: repeat.
enemy.moveToLocation = new Point (getRandomNumber(0, Stage.Width), getRandomNumber (0, Stage.Height));
enemy.OnEnterFrame = function ()
{
if (enemy.X > moveToLocation.X) { enemy.X -= enemy.movingSpeed; }
else { enemy.X += enemy.movingSpeed; }
// continue
if (getDistance (enemy.X, enemy.Y, moveToLocation.X, moveToLocation.Y) < movingSpeed)
{
enemy.moveToLocation = new Point (getRandomNumber(0, Stage.Width), getRandomNumber (0, Stage.Height));
}
}
getRandomNumber(min:Number, max:Number):Number
{
return (Math.floor(Math.random()*(max-min+1)) + min);
}
getDistance (x1:Number, x2:Number, x2:Number, y2:Number):Number
{
var xd = x1 - x2;
var yd = y1 - y2;
return ((xd * xd) + (yd * yd))^0.5;
}
The above code was quickly typed to give you an idea on how you could be doing this. Though, you may not want to use the geom classes for point, but rather create your own one. And also, there are better ways to do this :P[/quote]
i have spent the first year on learning the basics in flash drawing and little actionscript
the second year i continued to make images and develop movies
the third year i started to learn the slightly more advanced actionscript
the fourth year i started to learn amazingly advanced actionscript, xml (reading and writing) and asp loading. (i am only 14 so i’m not very good at leaning anyway :-D)
your code didn’t really work but thanks for your help
Stupid Saint