i use this openGl forum first time.hope u all are help me here.i read all algorithms about collision detection but could not understand how to apply in my game.my game is gold finder.i load a image and and that move and collide with a gold piece then score incress.this is my theme.plz help me how to apply collision detection in this.can i give you my code??
thnx in advance…
in your case the simplest one would be to check the distance between your avatar and each pice of gold, if it’s close enough you count it as a hit.
thnx 4 reply my question.i made a class of gold and pass the position where it place on the game screen.and moving image is continously move through arrow keys up,down,left or right…then how i find distance between them??this is basic problem .i know.but i m not good in c++ or programming.give idea of thz.i know how to find distance between two points in maths but not at there.thnx if you solve my this problem.
it’s exactly the same, though i suspect that this is not your main problem, that would be trying to make a game without a simple scenegraph, so simply put this is what you should be doing.
- the game should run as a simulation
- this simulation has objects like gold, enemies, players and cameras with properties such as possition, direction, speed, state and so on.
- you change various states(like up-speed if your holding the up key) in it and then evaluate it (ie. making everything move based on these new states).
- you then use these coordinates to render everything
then when this is done you can just use this
sqrt((a*a) + (a*a) + (a*a))
to get the distance
thnx 4 your coperate…
i’ll try this.in my game camera is not enable till now.now i’ll do.and think in a such way.then tell you about my progress.ok
This is not an OpenGL question. You could perhaps post this tyope of question to our math & algorithms forum or a more general game programming forum like those on gamedev.net.
Please restrict posts here to the OpenGL API and topics more directly related.