mccoyst / min-game

Automatically exported from code.google.com/p/min-game
MIT License
2 stars 1 forks source link

Fix possible overflow in the camera #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If the camera doesn't wrap around any more module the world size.  This means 
that the player could continually hold one direction until the camera's offset 
overflows or underflows.  A fix would be to wrap the camera's offset value 
module the World width and height (see 
http://code.google.com/p/min-game/source/browse/game/world.hpp?r=2100e1651743ff7
8affff138d670282829be3eb7#97).

Original issue reported on code.google.com by burns.ethan@gmail.com on 16 May 2012 at 11:05

GoogleCodeExporter commented 9 years ago
Any thoughts on a clean fix for this?

Original comment by burns.ethan@gmail.com on 16 May 2012 at 11:05

GoogleCodeExporter commented 9 years ago
BTW, the link above in the issue description is the *previous* behavior, to 
demonstrate how we use to wrap the offsets.

Original comment by burns.ethan@gmail.com on 16 May 2012 at 11:07

GoogleCodeExporter commented 9 years ago
I'm not too worried about it, in this case. For a 512x512 tile world, it'd take 
262,144 laps to overflow or underflow on 32-bit systems. If someone's that 
patient, they can consider it an easter egg when the world image snaps over by 
a tile (or whatever manifests).

Original comment by Mcco...@gmail.com on 17 May 2012 at 12:01

GoogleCodeExporter commented 9 years ago

Original comment by Mcco...@gmail.com on 17 May 2012 at 12:04

GoogleCodeExporter commented 9 years ago
Well, we are using Fixed, so it's actually 16,384 laps. However, that's still a 
hell of a lot.

Original comment by Mcco...@gmail.com on 17 May 2012 at 12:11

GoogleCodeExporter commented 9 years ago
OK

Original comment by burns.ethan@gmail.com on 17 May 2012 at 11:54