Hi you guys!
I have been working with a little game in openGL for a while and things have worked out pretty well until now..
It's like the classic game spaceinvaders.. You see I'm using c++ and Codeblocks as IDE. and I've tried to make a spaceship that you can rotate and move in the rotated direction. I've also tried to make a weapon to the ship..
Hope someone of you can tell me about or give me somewhere i can read about the general structure of this two things.
~Xrid3r
openGL - game problem
This really isn't anything to do with opengl, but more of a game design question. OpenGL renders meshes to the screen, and has nothing to do with input controls or "making a weapon".
That sounds more like Asteroids than Space Invaders.
What part do you need help with exactly?
What part do you need help with exactly?
My opinion (sometimes I feel I'm alone with this):
A very important thing in game programming and programming in general:
There's no "weapon" there's no "spaceship". There's only the code. It is very important to understand. If you can define the behaviour of the "weapon" in detail (what you expect it to do), you almost did the job.
And to learn this: you have to struggle with it alone.
A very important thing in game programming and programming in general:
There's no "weapon" there's no "spaceship". There's only the code. It is very important to understand. If you can define the behaviour of the "weapon" in detail (what you expect it to do), you almost did the job.
And to learn this: you have to struggle with it alone.
Hi i'm assuming your fairly new to this to.
In order to rotate an object in openGL or most other languages (I think). You have to use trigonometry.
If you convert the angle into radiens. You can then multiply this by a speed to get the spaceship to accelerate and move in the direction you wish.
To convert to radiens you take your (angle/360 * 2 * pi)
You can multiply this by sin or cos (which gives you a number between 1 and -1)
then multiply this by the speed for movement.
For example if you want your spaceship to turn 180 degrees the Z would be -1 with trig. if the speed is 5 5*-1 is -5 allowing your ship to move backwards.
Hope this helps I would look at http://www.silverlightbuzz.com/2009/03/29/rotation-controlled-direction-using-trigonometry-and-radians-in-silverlight/
for a quick overview of this
Hope this helps
In order to rotate an object in openGL or most other languages (I think). You have to use trigonometry.
If you convert the angle into radiens. You can then multiply this by a speed to get the spaceship to accelerate and move in the direction you wish.
To convert to radiens you take your (angle/360 * 2 * pi)
You can multiply this by sin or cos (which gives you a number between 1 and -1)
then multiply this by the speed for movement.
For example if you want your spaceship to turn 180 degrees the Z would be -1 with trig. if the speed is 5 5*-1 is -5 allowing your ship to move backwards.
Hope this helps I would look at http://www.silverlightbuzz.com/2009/03/29/rotation-controlled-direction-using-trigonometry-and-radians-in-silverlight/
for a quick overview of this
Hope this helps
Quote:Original post by eskimo456
To convert to radiens you take your (angle/360 * 2 * pi)
Unless im totally off here, OpenGL uses degrees not radians.
Quote:Original post by marius1930There's a couple of deprecated OpenGL convenience functions that use degrees (e.g. glRotate*()), but generally speaking, using OpenGL in no way means you have to use degrees in your own code.
Unless im totally off here, OpenGL uses degrees not radians.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement