All Messed Up

Started by
0 comments, last by Ructions 20 years, 3 months ago
I am making a arkanoid type game and am new to opengl i am finding it difficult to understand the positions of objects on the screen. I have got a paddle moving aross the screen using the keys and it stays in side the window. but when i tryed to use the mouse to move it it messed up. i got this piece of code off the internet and used it but i dont really know what it does if you can answer any of my questions or tell me what this code does. thank you in advance. Code: paddle.x=(float) mpos.x/640*5.4f-9.4f;
Advertisement
Hello,

I am not sure what you are using for input but the mouse is usually relative. If it moves one pixel over then you should get a result of 1 but the mouse is very sensitive, so you may have to reduce the amount.

paddel.x += mouse.x/speed

dividing by speed give you the ability to slow or speed up the mouse reaction.

Ben

This topic is closed to new replies.

Advertisement