Comments (8)
How width/height is calculated: https://github.com/pixijs/pixi-tilemap/blob/master/src/RectTileLayer.ts#L105
For every tile you add, minX maxX is calculated.
What exactly is empty tile?
from tilemap.
If you mean that "tilemap should store width/height independently and ignore tiles that go out of those bounds" - no, sorry, those fields are calculated , its your problem to store width/height you want in your own tilemap. If you guys want different w/h - override the setter getter, like its done in pixi TilingSprite or Sprite
from tilemap.
also you can override calculateBounds of CompositeRectTileLayer or just RectTileLayer to take your own _$_width _$_height local vars , for example.
from tilemap.
Thank you for explaining :)
I did a manual calculation on gdevelop's wrapper for pixi-tilemap, but it would be nice if we could have these be calculated and stored by pixi-tilemap somewhere :)
Having the absolute width/height of the resulting tilemap is very useful when used in game engines which require it.
Gdevelop uses this to do the bounding box of the object, which has an effect on
- whether the object gets rendered at all (if the bounding box is incorrect size, this leads to gdevelop thinking its not in the camera view and it doesnt render it at all sometimes)
- being able to select the tilemap in the engine's IDE - to move and resize it
from tilemap.
I am silly, we never add these empty tiles to pixi tilemap - so it has nothing to work with for estimating proper boundaries.
@ivanpopelyshev I think I will close this bug, the fault is in the wrapper- since it never tells pixi-tilemap about them. But how do we tell to pixi-tilemap to change it's width/height externally? That would be incredibly useful for our case
from tilemap.
override calculateBounds() to add minX/maxX/minY/maxY that you specify in it :) , just use addFramePad two times - one for real tiles , one for your extra bounds
from tilemap.
At the same time, you have to do something about "width/height" property, if you want to use it for your own set bounds, and not pixi calculated ones.
from tilemap.
@ivanpopelyshev you make it sound like it would be simpler to just store it in my wrapper's variables - like I did on the PR at gdevelop 😄
sorry for raising a false alarm, took me a bit to realize it
from tilemap.
Related Issues (20)
- index.d.ts is not bundled with pixi-tilemap 2.1.0 HOT 13
- Import `PIXI` instead of requiring it to exist globally. HOT 11
- Missing textures crash the renderer HOT 6
- LDtk Json support HOT 4
- Feature request: Applying tint HOT 2
- id for tile HOT 7
- CanvasRenderer using incorrect asset from spritesheet HOT 11
- newest pixi-tilemap fails with renderer.plugins.tilemap undefined HOT 16
- CompositeTilemap has no `add` method, despite the example HOT 1
- tileAnim does not work for negative offsets HOT 1
- Tiles are reset to original, after x amount of changes HOT 2
- collision
- Update to newer PIXI version HOT 1
- Not working with new `cullable` property from `PIXI 6.3.0`. HOT 4
- Not working since PIXI 6.4.0 HOT 2
- Not compatible with Pixi 7 HOT 9
- Importing pixi tilemap does not work HOT 3
- Missing dependencies
- Texture ID is only set when composite parent is true.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tilemap.