bullets movement patterns

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
Blanc

bullets movement patterns

Post by Blanc »

Hi all,

How could I program the movement of bullets with
arbitrary pattern?

say, they move straight with different angles and velocities

possible for them to move in curves?

what's the easiest to handle them? as i have to monitor their
movements and collisions with other objects...

Blanc
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Doing something like x=-y^2 would be fine.
You can do a code to calculate something like this if you want to change angles and velocities. Looking at the Solar War's source would be a good starting point.
Useless, lumbering half-wits don't scare us.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

The easiest and most realistic way to move bullets in curves is to keep fixed-point velocity and displacement vectors for each bullet. Then each frame perform Euler integration: add accelerations due to force (gravity, wind, etc) to velocity, add velocity to displacement, and take the integer portion of displacement and put it on screen.

Go look up analytic geometry and Newtonian kinematics on Wikipedia if you want some background.
Post Reply