Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by tarrent

Hi, I'd like to ask if ig.game.sortEntitiesDeferred() has browser compatibility issues because a sample game of mine using this works well in Mozilla Firefox but doesn't in Chrome.

http://tarrent.webs.com/html5/index.html

I'm using ig.game.sortEntitiesDeferred() to sort out entities specially the square characters. Without sortEntitiesDeferred(), they would spill out the top golden frame when going up for a spin. The game works well in Chrome if I remove this, but the characters spill out of the top frame.

I call ig.game.sortEntitiesDeferred() after the characters have been finalized in place. To be exact, here are the entities' zIndices:

- red background = 3
- violet background = 1
- buttons = 3
- blurred spinning animation = none
- square characters = 2

When would be the best time to use ig.game.sortEntitiesDeferred()? Do this really mess up in chrome? Thanks.

1 decade ago by lazer

I use this to resort after spawning an entity and setting its zIndex; haven't seen any problems in Chrome so far. Example of usage:

	generateObstacles: function() {
		var rand=Math.floor(Math.random()*100);
		if (rand < 1 && this.terrain === 'land') {
			var e = ig.game.spawnEntity (EntityPit1, ig.game.player.pos.x + 700, 420);
			e.zIndex = -1;
			ig.game.sortEntitiesDeferred()
		}
	
		else {
			ig.game.spawnEntity( EntityCollision, ig.game.player.pos.x + 300, 420 );
		}
	},

1 decade ago by tarrent

Thanks lazer for your info I see you call ig.game.sortEntitiesDeferred() everytime you spawn an entity whereas I call this only after all entities have been randomly generated.

I have tried your way, ig.game.sortEntitiesDeferred() on every spawnEntity but the results are the same :(

1 decade ago by dominic

What exactly happens in Chrome when you sort the entities? I can't see any difference with Firefox vs. Chrome. Can you provide a screenshot, maybe?

1 decade ago by tarrent

Hi dominic does my game seem ok for you in chrome? I wish it were so for me, browser version perhaps? :) Btw I'm using Chrome 19.0.1084.56 m and Firefox 13.0.1.

I've provided game play videos of my sample game in Firefox and Chrome.

Firefox
http://tarrent.googlecode.com/files/game-firefox.7z

Chrome
http://tarrent.googlecode.com/files/game-chrome.7z

I hope you could help correct what I may have done wrong in using .sortEntitiesDeferred(), if this is the problem. Thanks!

1 decade ago by tarrent

Just updating this thread :)

I'm not sure what I did but its ok now. I cleaned up my codes, removed unnecessary functions and variables and then no more zIndex issues.

http://tarrent.webs.com/html5/index.html
Page 1 of 1
« first « previous next › last »