Page 1 of 1

asteroid animation/A.I.

PostPosted: Thu Feb 16, 2012 2:06 am
by praaab
i want my asteroid to rotate slowly (like an animation but using code) and towards me (the spaceship), but i after it passes me it has to just keep going and not to continously follow me. I really need help and i have no idea how to do this.

Re: asteroid animation/A.I.

PostPosted: Thu Feb 16, 2012 2:21 am
by skydereign
How do you mean follow you? It sounds like you want the asteroid to spin (so rotated frames) but it also sounds like you are dealing with trajectories. What is making the asteroid follow you? If you want the asteroid to move toward you while spinning, but when it passes you to stop, you can add something like this (it assumes asteroids are coming from above the player).
asteroid -> Create Actor -> Script Editor
Code: Select all
directional_velocity=3;


asteroid -> Draw Actor -> Script Editor
Code: Select all
if(y<player.y)
{
    angle=direction(x, y, player.x, player.y);
}


If though you didn't want the asteroids to home on the player, than you can just put the angle code in the asteroids create actor. As for the rotation, from what you've given using an animation should work.

Re: asteroid animation/A.I.

PostPosted: Thu Feb 16, 2012 10:02 pm
by praaab
Thanks for the help but is there any way to make the asteroid rotate in its place without animation, Just code?

Re: asteroid animation/A.I.

PostPosted: Thu Feb 16, 2012 10:28 pm
by skydereign
Essentially no. You'd either have to use the canvas (this could be pretty slow), or wait for the gE 1.5 which supports rotation. But if your concern is having to rotate the animations yourself (instead of the increase in size of your game) there are plenty of ways to automatically rotate your images for you.

Re: asteroid animation/A.I.

PostPosted: Fri Feb 17, 2012 8:36 pm
by praaab
Im useing gimp for the rotation animation but wats a good way to make a smooth rotating ani
matiion?

Re: asteroid animation/A.I.

PostPosted: Fri Feb 17, 2012 8:40 pm
by skydereign
Ah, well with gimp if you want to do rotations, I'd recommend creating the image twice its size. Then rotate it, and scale it down. It makes the whole thing seem smoother. Though you can also make the base image and then use DST's sprite rotater, and then scale it down. It should net the same effect. http://game-editor.com/forum/viewtopic.php?f=1&t=9418&p=65281

Re: asteroid animation/A.I.

PostPosted: Sat Feb 18, 2012 5:54 pm
by praaab
thanks for your help +1 for u

Re: asteroid animation/A.I.

PostPosted: Mon Feb 20, 2012 9:26 pm
by Clokio
I propose anime studio, you import your png, then you do a animation of rotation. Then you export it. Then with LS maker you get each frames. And with paint.net or gimp or else, you remove the background to make it transparent.
You can export frame by frame with the pro version.
In GE when you want a rotation you start the animation.

The advantage is that you would be able to adjust the speed of the rotation compared to gimp or other that you will have to calculate it yourselves. :mrgreen:

Re: asteroid animation/A.I.

PostPosted: Thu Feb 23, 2012 3:13 am
by tintran
since you're already using GIMP, why don't you give this plugin a try?
i wrote it myself when i wanted to quickly rotate an image into a horizontal image of 36 frames for example and didn't want to manually rotate each frame in GIMP.
it's here http://tinyurl.com/6no2tdr
to quickly have an image of 36(or whatever the number of frames) i just using Rotate Tile and then Horizontal Stitch.