Unit Movement for Shooter
Hi Folks,
So I've been working on a shooter for quite some time now and I have hit a brick wall and was wondering if ya'll could help me out. I've managed to make my enemy movements if the ships are already placed on the screen but however, for the actual game for some stages they will be following galaga type movements before settling and in others more like galacta where they never actually stop.
It is this initial galaga type entry I am struggling with and the movement for galacta. Any ideas how I can handle this? I've come to the conclusion pathfinder isn't ideal for this since the movement is preset and continuous.
Galacta
Galaga
I'm not looking to make a clone but I seek to understand how to make similar movements. If I know how I can make my own movements.
Any ideas?
Much appreciated amigos!
Comments
I think this can be done with sin and cos functions . I don't really know much when it comes to trigonometry . I tried by interpolating the radius & centre point. Im sure this isn't the way to do it but can work by playing around with numbers
"It is this initial galaga type entry I am struggling with and the movement for galacta. Any ideas how I can handle this?"
Nearly two and a half hours of video !! Could you tell us where in the video to look ?
My apologies. An example would be from the second video 00:20-00:30 or 02:09-02:15 when the come from off screen before the settle up top. Or the First video when the come from off screen and move in pattern from 00:13-00:24.
Any demo? How are you making them settle after moving? I have mine from a standstill and then moving untill off screen.
There are probably many ways to do this. Perhaps the easiest is with a few timers. Attached is a crude demo.
+1
Nice, has the right feel for an 80's arcade kinda' thing.
Its crude but shows the basic principles. (In an 80's arcade kinda' way.)
Cheers!
Thanks! Just What I needed!
@RThurman the movement is linear right. And if I wanted it to be curved or with loops etc how would I do that?
Here are some curved, swooping, looping moves, might be some use.
File attached.
Oh my word, I know nothing!!!! This is amazing. I really do need to wrap my head around sin and cosine and the range of usages they have!
//
Attached is a simple GS project that shows you how cos/sin relate to angles. If you grab the white dot that sits on the edge of the circle and drag it around . . you can change the angle of the white line.
Once you have arrived at an angle (choose any angle you like) you can see that that angle has both a cosine value (shown by the red line) and a sine value (shown by the blue line).
The cosine is very simply the horizontal distance from the centre of the circle to the point on the edge where the line hits it. The same deal with sine, the sine is very simply the vertical distance from the centre of the circle to the point on the edge where the line hits it. Cosine = X . . . . Sine = Y
So we say . . . . (examples):
the cosine of 35° is 0.819
the sine of 110° is 0.94
the cosine of 110° is -0.342
the cosine of 0° is 1
the sine of 170° is 0.174
. . . etc etc
Or to put it mathematically/in GS syntax:
cos(35)=0.819
sin(110)=0.94
cos(110)=0.342
cos(0)=1
sin(170)=0.174
. . . . etc
Hope that makes sense.
It does. Thanks! Using you explanation and the samples above I'me going to play around until i have decent grasp of it. I have another of your demos that creates a rainbow effect using sine and cosine and I'm going to lack at that too.
You are welcome!