rich

Please help test the Phaser 1.1.4 release

Recommended Posts

Thanks for all this feedback guys, I really really appreciate it :)

 

WeaveMN - I agree re: cameraOffset and will see if I can't do away with it totally.

 

Right now I'm working on setting the Body's "blocked" state. A body is set to be blocked in any of the 4 directions, for example if it's against the world bounds, or has hit a tile. However the blocked state was never checked in the physics collisions, meaning a sprite could push another sprite into a tile/bounds, even if only by a little bit, it would still make things judder. Right now I'm close to finishing this so that will never happen. Then I need to test some stacking sprites and high velocity stuff.

Share this post


Link to post
Share on other sites

one more thing: :)

 

Tilemap.putTile isn't correctly (re)setting the collision data for the tilemap. calculateFaces is being called, but that doesn't do everything necessary, apparently.

 

I think this is happening only when changing to a tile that is NOT collide-able. The original setCollision call set faceX to true for all the tile's faces, and calculateFaces will only ever set it to false based on the tiles around it. so it remains collide-able even after changed. I'll see if I can get to the root of it and get a fix PR, since I'm halfway there already...

Share this post


Link to post
Share on other sites

it looks like if I pass a Tile object to putTile, rather than an index, that this would work. but I believe an index ought to work properly as well.

 

(the culprit is that the same Tile object is retained in memory and only the index is changed - so its collides property etc aren't updated. so my prior line of thinking was incorrect, this would happen going from collide-able to non-collide-able and vice versa)

Share this post


Link to post
Share on other sites

Rich -

 

because the list of 'collide-able' tile indices is not saved anywhere, there's no quick way to make putTile correctly set the 'collides' property if it is given a tile index. the work-around, as stated above, is to pass a complete Tile object rather than an index, so this isn't blocking any functionality, it just works in a counter-intuitive fashion. I believe the fix would require keeping the list of 'collide-able' tiles (or an exclusion list). easily done, but I don't want to post a PR with that unless you think it's appropriate.

 

for now I'll pass the full Tile object in my code

 

cheers

Share this post


Link to post
Share on other sites

Hello,

 

Great work with this new version !

Tilemaps fix all problems I had (black borders when moving the camera, troubles with collisions).

However, I have an issue with the "follow" method of camera. I've created a "deadzone" but the camera moves too slowly and my player goes out of viewport.

 

You can see that here : http://folia-game.herokuapp.com/

 

Here is my code to ask the camera to follow the player (in level.js) :

// tell the camera to follow the playerthis.game.camera.follow(this.player.sprite);// give the camera a deadzone (to don't move all the time)this.game.camera.deadzone = new Phaser.Rectangle(	this.game.camera.width * 0.3, this.game.camera.height * 0.3,	this.game.camera.width * 0.4, this.game.camera.height * 0.4);

Good luck !

Share this post


Link to post
Share on other sites

I use "Phaser.Camera.FOLLOW_PLATFORMER" when setting the camera to follow the player sprite, this runs into the same bug as mentioned by Mefteg in #32.

(I guess internally it will just set a deadzone.. well just checked, yes it does.)

Share this post


Link to post
Share on other sites

Another small thing I can report (don't know if it's already mentioned)

 

Using gravity + velocity to jump the player and coliding with a tilemap (as the ground) and no bounce the following happens:

 

Issue: when landing after a jump the touching.down jitters for a few frames (from true to false and back again alternating everytime update() is called).

 

This is highly visible if you (as in my case) you change the frame of the player based on the body.touching.down variable.

Share this post


Link to post
Share on other sites

Rich -

FYI, in case you hadn't noticed, as of commit abdaaa0010afde2f50b3ab927365a8f1907cac52 sprites (in a side-scroller with gravity) slowly sink through the tilemap (and right off the map if they are not constrained to the world bounds)

 

cheers

Share this post


Link to post
Share on other sites

All is well as far as my game was concerned.  I had to change the onStartCallbacks and onCompleteCalbacks, but I know that was intentional and was a quick fix.  (Literally just a replace "Callback" -> ".add")

Share this post


Link to post
Share on other sites

I just downloaded the dev branch a few minutes ago and I'm having a lot of problems just getting the tilemap examples working, including starstruck.  The sprite will bounce on each "level" on the way down but still ends up on world bounds and none of the horizontal walls will collide.  I also noticed in the sci fly the emitter's particle burst collides with the layer correctly but the sprite still doesn't.  Is this something that you are aware of and are still working on?  I've tried it on Chrome as well as an iPad.

 

WaltDjr

Share this post


Link to post
Share on other sites

**this has been solved, and was a product of my not using setCollisionBetween() correctly. Thanks jcs!**

 

here's a weird one regarding tilemap collisions. I only get collisions between sprites and a tilemap layer to work if i set the collision layer as the very last layer in Tiled. If i set my collision layer as anything but the last layer in the Tiled editior then collision in Phaser won't work.

 

pic of what i'm talking about ("foreground" is the layer i'm doing collision with):

rsOl5Qg.png

 

Here's what my create() and update() bits look like, and how i'm doing collision:

create: function(){		this.map = game.add.tilemap(this.mapName);		this.map.addTilesetImage('grass70x70');		this.layerSky = this.map.createLayer('sky');		this.layerFar01 = this.map.createLayer('far01');		this.layerForeground = this.map.createLayer('foreground');		this.map.setCollisionBetween(0, 36);}update: function(){		game.physics.collide(this.player,this.layerForeground);}

I haven't looked into it because i can fix it by messing with the order in Tiled, but it's just a little annoying having my background layers in front of my foreground layers in Tiled.

Share this post


Link to post
Share on other sites

Here's another one about timers and events. If i set an event to repeat via game.time.events.repeat(), and in the same update cycle i also set an event to fire only once via game.time.events.add() and the callback function for the game.time.events.add() contains another game.time.events.add() then it stops the repeat from repeating and only happens once.

 

for example inside a chrome dev console you can verify via the following:

doNothing = function(){};doSomething = function(){      game.time.events.add(300, function(){console.log("do something once");},this);   }//THIS ONE HERE WORKS (executed on the same line in the chrome dev console):game.time.events.repeat(300,10,function(){console.log("repeating 10 times")}, this); game.time.events.add(300,doNothing, this);//THIS ONE HERE DOES NOT REPEAT MORE THAN ONCE:game.time.events.repeat(300,10,function(){console.log("repeating 10 times")}, this); game.time.events.add(300, doSomething, this); 

I did not play with the durations, and just kept it at 300 for arbitrariness.

Share this post


Link to post
Share on other sites

@99golems:

 

TileMap.setCollisionBetween() takes an argument for the layer that you want to set collision on. If you don't specify one, it defaults to the current layer and thus you get the behaviour you're seeing.

Share this post


Link to post
Share on other sites

This might seem silly but, have you tried changing this 

create: function(){    this.layerSky = this.map.createLayer('sky');    this.layerFar01 = this.map.createLayer('far01');    this.layerForeground = this.map.createLayer('foreground');

to this 

create: function(){    this.layerSky = this.map.createLayer('sky');    this.layerForeground = this.map.createLayer('foreground');     this.layerFar01 = this.map.createLayer('far01');

Share this post


Link to post
Share on other sites

Hi,

 

The 1.1.4 version solved many problems and improved my game, thank you so much (one more time) ;)

I just have a big problem to load tilemaps, maybe I'm doing it wrong (many people says that it's ok for them), but I can't see where.

You can check an example here : http://benjans.altervista.org/

It's very basic, and i've got this error :

Phaser.Cache.getTilemapData: Invalid key: "0" 

No tiles are displayed (and according to the network pannel of my debug console, the JSON file and the tileset are not loaded)...

Do you see what i'm doing wrong ?

 

Thank you !

Share this post


Link to post
Share on other sites

Benjans: The format of your load.tilemap call is slightly wrong. You've got:

game.load.tilemap('world', 'tileset.png', 'map.json', null, Phaser.Tilemap.TILED_JSON);

But the actual method signature is:

game.load.tilemap('map', 'assets/tilemaps/maps/features_test.json', null, Phaser.Tilemap.TILED_JSON);

Share this post


Link to post
Share on other sites

Right.. last week was a bit hectic finishing off some client projects, but I've a pretty clear run in Phaser this week - so time to battle on with my last physics updates and go through the bugs / feedback reported here and on github and get 1.1.4 finally out the door.

Share this post


Link to post
Share on other sites

I found a small bug (trying to create the interfaces for my game), it was already here in the previous version.

When you put several texts on the stage and try to fix it to camera, X and Y properties are not respected, and they are put on 0,0.

You can check it here : http://benjans.altervista.org/

 

This is my code :

var style = { font: "12px Arial", fill: "#ffffff" };var t1 = game.add.text(10, 10, 'This is the first sentence', style);t1.fixedToCamera = true;var t2 = game.add.text(100, 100, 'This is the second sentence', style);t2.fixedToCamera = true;

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.