-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.x] TileMap: Horizontal Wrapping #422
[4.x] TileMap: Horizontal Wrapping #422
Conversation
5fdd5b3
to
b5521ec
Compare
696bd81
to
96b3b62
Compare
Seems to work well after several circumnavigations. I'm still wrapping my head around how this works, pun intended, but is there any potential issue with scrolling indefinitely? |
The camera never goes more than one full map-width beyond the "main" map. Once it reaches that point, the camera's location is translated one map-width back towards the origin, so in terms of infinite scrolling it will just keep wrapping back towards the origin |
public bool isTileInView(Tile tile, MapView map) { | ||
Rect2 visible = getVisibleWorld(); | ||
Vector2 target = map.tileToLocal(tile); | ||
float size = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this number? Can it be derived from something, and it not made a constant somewhere? I think we'd discussed having a class to hold all map related constants.
if (atEdgeOfRightWrap(visibleWorld)) { | ||
Translate(Vector2.Left * map.pixelWidth); | ||
} else if (atEdgeOfLeftWrap(visibleWorld)) { | ||
Translate(Vector2.Right * map.pixelWidth); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessarily needed right now, but Civ has a gradient where the scroll speed increases as the cursor approaches and pushes into the map edge
If nothing else let's merge this :) |
add Camera2D test drawing units in word coordinates wip simplify unit sprite test demo - AnimationManager could be simpler but trying to keep diff small enable pixel snapping - removes world seams render roads in tilemap add logic for drawing rails on tilemap - missing separate layer working rails layer simple abstraction for loading atlas sources add resources and clear cells when empty track net lines changed working rivers separate notion of layer and atlas in MapView add mountains get rid of incorrect y offsets (tiles are already centered) offset is necessary for oversized tiles... add volcanos single terrain overlay add full left skirt to terrain layer detect edges of map in world space fix bad bounds for forest tiles and use full resource tileset wip tile set loader so specific assets can be overwritten in the future add marsh to tilemap terrain overlay layer camera can center on tiles buildings on tilemap remove ported code load goodyhut pcx pixel perfect transforms dedupe code enable Y sort for each tilemap layer kinda working animations wip wip working sprite animations render best defender on top of unit stack significantly faster animation loop when only doing visible tiles draw cursor remove ported code
96b3b62
to
0d14b81
Compare
No description provided.