Skip to content
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

Isometric view #82

Open
spassvogel opened this issue Apr 25, 2020 · 4 comments
Open

Isometric view #82

spassvogel opened this issue Apr 25, 2020 · 4 comments

Comments

@spassvogel
Copy link
Contributor

I'm trying to figure out if this plugin would be good to use for isometric projects. I'm guessing that in principle it's possible to use, we just have to calculate the position of each tile properly.

But then how to deal with z-axis occlusion?

@ivanpopelyshev
Copy link
Collaborator

I'm guessing that in principle it's possible to use, we just have to calculate the position of each tile properly.

pixi-tilemap is low-level lib, not something that dictates you coords. It only implements "fill tilemap, clear before refill" idea. No buffer reuploaded needed between refills.

You have to do it anyway because pixi is not a engine/framework. You have to decide which isometric coord you want. I recomment to look through those topics: https://www.html5gamedevs.com/search/?q=isometry&quick=1&type=forums_topic&nodes=15

As for Z-index, I wanted to make a plugin for it, automatic isometric Z-sorting with cutting sprites when needed, but not many people expressed interest in it. Please make your case more clear, post demos, show the progress - maybe i'll help with it.

basic thing is just sort by center-y of tile.

I personally recommend to store tiles in 2D array in cells that have (i+j)%2==0 and ignore others. then coord sytstem wil look like x = i * tileWidth/2, y = j*tileHeight/2. You want to test a point whether it belong to tile - you have to make a formula for diamonds, as an exercise :)

@spassvogel
Copy link
Contributor Author

Yeah the coordinate thing is not the tricky part I think. The z-index is much more complicated. I'm guessing you would sort this out in the shader, right? But then you have a player sprite, enemies, etc walking around the map they would have to be affected by the z-index too.

I havent started experimenting with isometric yet, mainly because I'm not sure if it's smart to use pixi-tilemap here or maybe use regular oldschool pixi sprites as it seems to offer more flexibility.

@ivanpopelyshev
Copy link
Collaborator

z-index on shader in 2d is a problemon its own.

No, i solve it with correct sorting of elements.

@ivanpopelyshev
Copy link
Collaborator

Yes, you can start with old-school sprites then switch to pixi-tilemap when you figure out all coords stuff :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants