PDA

View Full Version : Shooting an enemy



vibi
04-14-2001, 02:32 AM
I want to implement code to shoot an enemy in Opengl. How do I figure out the position of the enemy once I have moved? In other words, how do you figure out the position of objects in the world after transformations to the user? Any help would be appreciated.

Michael Steinberg
04-14-2001, 02:34 AM
That is no question to post here...
Anyways.

You've got worldspace position of user?
+ You've got worldspace position of enemies?
--------------------------------------------
Where is the problem?

LordKronos
04-14-2001, 03:25 AM
The problem is that vibi seems to insist on posting (pretty much the same) off topic questions here.

Here is a better place to ask these types of (non-OpenGL) questions:
http://3dgamedev.com/lists/algo_list.asp

duckman
04-14-2001, 08:28 PM
To me It souds like you are not using world space coordinates.

Make sure you store x,y pos for the main char +
diriection vector of main char.

store x,y pos of enemies.

when you draw the screen draw always the x,y pos of the main char
when you move the char alter it x,y pos (dont just call glTranslatef)

With this info the rest is simple maths.

This is a seriosly simple question to ask, Get a few good
books on graphics programming and reed them. Learning purley
on the internet can be difficult.