colinvella / phaser-tilemap-plus Goto Github PK
View Code? Open in Web Editor NEWTilemap animations, physics, events and custom property enhancements for Tiled JSON map files
License: MIT License
Tilemap animations, physics, events and custom property enhancements for Tiled JSON map files
License: MIT License
Hello Colin,
do you think if it's somehow possible to trigger a Tile Animation
on a specific Region Based Event?
I'm trying to animate door tiles in my game, but don't know how to do that without
using Sprite Animations or Tile Sprites.
I uploaded a GIF to show you what i mean:
https://ibb.co/ijSxmb
Thanks for your help!
basically the plugin doesn't seems to be loaded, but its recognised when using plugins.add. I tried reading tilemap from this. and this.game. Cant seem to find the loaded plugin. I have stolen code from your demo to see if I could make it work.
do you mind taking a look at my code? sorry for the trouble and thanks for this amazing plugin :)
https://github.com/Raagh/a-game-needs-no-name
npm install && npm run web
I realize this is a nice-to-have, but would make using animations more plug-and-play:
When calling this.tilemap.removeTile(x, y, layer)
(or "swap", "randomize", etc...), the corresponding this.tilemap.plus.tileAnimations[*].tileLocations[*]
doesn't get "corrected".
I've currently got a crude external approach:
// keys: 23-27
// spear: 28
// dagger: 29
// money: 30
if (itemsTile && itemsTile.index >= 23 && itemsTile.index <= 30) {
this.tilemap.removeTile(
this.player.x,
this.player.y,
this.itemsLayer,
);
// remove rotating "key" animation?
if (itemsTile.index >= 23 && itemsTile.index <= 27) {
const anim = this.tilemap.plus.animation.tileAnimations.find(
animation => animation.frames[0].tileId === 22,
);
const ind = anim.tileLocations.findIndex(
location =>
location.x === this.player.x &&
location.y === this.player.y,
);
anim.tileLocations.splice(ind, 1);
}
}
But would be sweet to have removeTile
patched to remove "any tileLocations
at given coordinates where tileAnimations
' frames
contains index
".
And while typing this, I just realized that I could just as well override TileMap.prototype.removeTile
and make this less clunky...
Maybe I'll send along a PR ๐
It's worth mentioning in the README that Tiled's "Tile Layer Format" matters when wanting to enable animations:
Phaser.Loader
Phaser.Loader
Phaser.Loader
Basically, the JSON needs it's layer data
to be Arrays of integers and not a String.
Took me forever to figure out why https://github.com/colinvella/phaser-tilemap-plus-demo was working, but my map wasn't...! ๐
I tried to get it work with Ninja physics, but that always gave me the error: "Cannot set property 'game' of undefined" in phaser-ninja.physics.js.
Since I'm not using a lot of ninja physics yet, I tried it without, but now I always get:
"Cannot read property 'properties' of null" in phaser-tilemap-plus.js.
Did I forget something in the installation?
When inserting this into my game i am writing using babel, this.game.tilemap is undefined
Hi!
Thank you a lot for your efforts !! This is exactly what I needed ! I'm sorry, I posted an issue before , and I found a solution ( it was due to the compression system I used in Tiled... and it wasn't due to anything in your work.)
I'm really sorry for the troubles.
Thank you again !
Hey !
First of all, awesome work man !
I have some issues in multiples cases like multiple collision at the same time.
Let me explain with an example :
update () {
// if sprite is colliding on the right and is on the floor then stop animate
// ( the sprite got a velocity.x of 200 and a velocity.y of 0)
if (this.body.contactNormal.x < 0 && this.body.contactNormal.y < 0) {
// never trigerred since contactNormal.y will always be = 0 because we can actually
only check one shape at the same time
}
}
I know it works well with stuff like slopes but when It's a < -1 && < -1 situation there is this issue.
If it is not an issue and I am just doing wrong stuff please help me ^^
Passing a preloaded json object to the game.load.tilemap()-function breaks map.
URL parameter is required.
Phaser tilemap accepts json object instead of a url.
Is there any workaround?
I see this project hasn't been updated in over 6 years. Any plans to add support for Phaser 3?
Any quick tips or thoughts about what it would take to support Phaser 3?
Hello colinvella,
I'm trying to enable physics with a custom Layer scaleRate
My code:
this.map = this.game.add.tilemap("testmap");
this.map.addTilesetImage('tileset');
this.backgroundLayer = this.map.createLayer('BackgroundLayer');
this.backgroundLayer.setScale(3);
this.backgroundLayer.resizeWorld();
My map.json already has a CollisionObjectLayer
Is there a way to get this work? I tried messing around with ShapeLayer.js
but it didn't work.
Thanks for you help and btw: I love your Plugin!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.