Creating twirling enemy attack patterns?
by Philip Mansfield · in Torque Game Builder · 12/21/2005 (8:52 am) · 3 replies
As I want to create a Galaxian/Galaga type game (just as an exercise really) I'm going to need to have enemy ships come twirling onto the screen and dive bombing the player.
I know I'm going to need some maths in order to generate the paths that the enemy ships should fly about in, but does anyone have any handy links to sites/threads that discuss generating this type of movement?
I have tried googling on a few key words but haven't come up with much so far. I can see in the shooter demo that a waveform is used, and that creates a nice undulating motion, but I want to be able to describe loops and turns for my enemy ships to follow.
If you need any visual hints as to what I'm after, http://www.tripletsandus.com/80s/80s_games/galaga.htm has a Java based Galaga game where the enemies loop about.
I know I'm going to need some maths in order to generate the paths that the enemy ships should fly about in, but does anyone have any handy links to sites/threads that discuss generating this type of movement?
I have tried googling on a few key words but haven't come up with much so far. I can see in the shooter demo that a waveform is used, and that creates a nice undulating motion, but I want to be able to describe loops and turns for my enemy ships to follow.
If you need any visual hints as to what I'm after, http://www.tripletsandus.com/80s/80s_games/galaga.htm has a Java based Galaga game where the enemies loop about.
#2
I setup a list of coords as part of the sprite: $enemy.positions("0 0 50 50 -100 100 l");
And then just read in the coords and send the sprite off towards it. Each time it reaches a point, it reads the next pair of coords. When it reads an "l" it just loops back to the first set of coords.
It works reasonably well, but every now and then it circles around a point like it it's looking for the next set of coords.
Still, much easier than using loads of maths that I don't pretend to understand at the moment :)
01/03/2006 (4:47 am)
I had a think about this, and I've started to fake it a bit by using .moveTo, .rotateTo and .setForwardMovementOnly.I setup a list of coords as part of the sprite: $enemy.positions("0 0 50 50 -100 100 l");
And then just read in the coords and send the sprite off towards it. Each time it reaches a point, it reads the next pair of coords. When it reads an "l" it just loops back to the first set of coords.
It works reasonably well, but every now and then it circles around a point like it it's looking for the next set of coords.
Still, much easier than using loads of maths that I don't pretend to understand at the moment :)
Torque Owner Jason Cahill
Default Studio Name
The keyword you are looking for is "spline" or "path." There's been some discussion of adding this kind of functionality into T2D in the C++ forum. Here is that thread.