Check bitmaps

Started by
13 comments, last by GameDev.net 18 years, 10 months ago
Anyone know how to check if there is a bitmap 2.0f under the player?
Advertisement
Yes but im not telling.

Seriously though, you have to tell us a little bit more of your problem for us to be able to help you.
Quote:Original post by Noxir
Anyone know how to check if there is a bitmap 2.0f under the player?


OpenGL isn't going to tell your program if there is a bitmap under the player.. Rather it is your program which tells OpenGL that there is a bitmap under the player.. OpenGL is only for display - all it does is draw exactly what you tell it to draw. So your program needs to have some data structures which store the layout of the map or playing field. It also needs some data structure which stores the position of your player. With these two things you can write an algorithm which checks for certain things, like: is the player standing on a LAVA tile? Is he standing on an ICE tile? Is he standing on a DRAGON? etc.

Software engineering is all about using clever representations of things in data structures and clever manipulations of these things with algorithms to achieve a desired effect in an efficient manner. There's no 'magic' to it and no shortcuts.

Richard
So there is no such code "if(Data/ground.bmp == p1y - 2.0f) { ground = true; }"?
Quote:Original post by Noxir
So there is no such code "if(Data/ground.bmp == p1y - 2.0f) { ground = true; }"?

No. Well, there is if you code it yourself.
You should never let your fears become the boundaries of your dreams.
I don't get this.. How I code it myself? I mean how I'm supposed to know that.
Quote:Original post by Noxir
I don't get this.. How I code it myself? I mean how I'm supposed to know that.

Here is a surprise for you: That's what programmers do. They/we code stuff. And usually first they/we have to learn how to do it.

Now seriously lay off with your thread starting. I see 8 threads on front page by you. Do a bit of research first before asking everything.
You should never let your fears become the boundaries of your dreams.
Haha I've researched very long for the stuffs I asked for but there seems no good OpenGL tutorial sites exists for RPGs etc. I'm going to buy a OpenGL book (that shows how to make a rpg etc) if you give me any good hints : )

You should never let your fears become the boundaries of your dreams.
I don't think you can find a book about doing rpg's in particular.
All you need for the rendering and graphical representation should be in the nehe tuturials.

But a tip is to separate the game and it's graphical representation.
So you don't check if the players stand on something after/during/trough rendering.
That is done internaly in your code trough some other method like a 2d lookup array or an insane amount of if statements or whatever.

If it works, use it.
If it doesn't, do something else.
If it can't be done, cheat and just make it look like it's been done.

Other than that you just have to find what you want and then copy it.
So you mean I have to do "if(p1x == 40.0f && p1y == 0.0f) { ground = true; }" on each little tile? U know how long that'll take? omg?

This topic is closed to new replies.

Advertisement