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.
That is no question to post here…
You’ve got worldspace position of user?
- You’ve got worldspace position of enemies?
Where is the problem?
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:
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.