Simple control at the bottom
Monkey Forums/Monkey Programming/Simple control at the bottom
| ||
Im trying to put in a really simple control for touch screens but id like the choice of it being at the top of the screen or bottom but for the life of me I cannot work out the maths on how to do it at the bottom. For the top it is the following PositionX = MouseX() * 2 PositionY = MouseY() * 2 The top left is pretty much spot on but the object moves twice as fast as the finger, which is exactly what I want but at the bottom. The X is going to be the same but the Y I just cannot seem to fathom |
| ||
Ahh solved it, seems hacky to me but worksMethod TerribleMaths:Float() 'Terrible maths for the Y joystick Local MouseMod:int = 2 'Step one get Y Local A:int = MouseY() 'Step 2 - it from 480 to reverse it so you are not working upside down Local B:Int = 480 - A 'Step 3 * it by mousemod B = B * MouseMod 'Step 4 Reverse it again A = 480 - B Return A End Method |
| ||
y=DeviceHeight()-((DeviceHeight()-MouseY())*2) |
| ||
Yes thats much better, I should of thought of that Thanks Muchly |