-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
The X & Y coordinate layouts are different throughout engine (?) #5
Comments
Welp, that's not something the LITIENGINE invented... Java AWT and Java 2D coordinate systems start from the top-left origin. Since the LITIENGINE is based on these Java implementations, we also inherited their way to handle coordinates. Honestly: When I first learned Java, I was also really confused about this but over time I got used to it.
Actually that's not exactly true. While locations in the To sum this up, the three "different" coordinates I can think of are:
All of these coordinates are based on the same coordinate system and have their origin in the top-left corner. Hope that clarifies things. |
Thanks for explaining. I don't claim any of this anything more than observations of a mathematically challenged programmer. What's your take on my experience not being able to send a creature's coordinates directly into the collision engine? It's always exactly one tile off, but everything always starts at 0,0. When I use the same coordinates, collision check & movement, everything is off by exactly one tile. I do really think that this is engine related. |
The Btw: many thanks for your open thoughts on this. It's always great to hear a fresh objective opinion on some stuff that we take for granted in the engine. |
No worries, it could be something I'm doing. Same thing with |
Some (or all or many) portions of LITIengine are inverted or different as to the standard XY Graph I'm used to in the United States:
I do get it, it depends on what your starting corner is. I actually do like that maps start at 0,0 top left and left to right, get larger. Makes math easier. But I do think at the same time, everything should start top left also.
The bottom line is it seems like
Camera()
coordinates are different fromPhysics()
coordinates are different fromCreature()
coordinates, etc, etc.I'm not a math guy but I can figure stuff out through a lot of trial and error.
My first implementation on this thing was a visual debugger.
There's some inversion required when generating
tmxMaps
->for y
first, thenfor x
I had to inverse the player's movements to convert it into something
Game.physics()
can understand.Here's some of the finagling I did to get collision to work properly:
Github Project:
https://github.com/evnsch/OpenHero/blob/master/src/main/java/com/escho/game/creatures/hero/HeroController.java
The text was updated successfully, but these errors were encountered: