Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes Need Simple formula tweaked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need Simple formula tweaked" Watch "Need Simple formula tweaked" New topic

Need Simple formula tweaked

richard gallagher

Joined: Mar 15, 2008
Posts: 9

This is a simple formula to move images on a screen left or right.
- The mouse is clicked on screen.
- Clicking on left half of screen gives negative value.
- Clicking on right half of screen gives positive value.

-The value newOffset is called in the renderer to create the shift in display.

Problem - If the user is as far left as can go (determined by "offsetX = Math.round(Main.newOffsetX);", the newOffset value is still modified. Likewise, clicking when the screen is as far right as it can go still modifies the newOffset value. I would appreciate help to stop this happening.

This is just the start of what im trying to do, and am aware of future issues, like different screen sizes.


I agree. Here's the link:
subject: Need Simple formula tweaked
It's not a secret anymore!