Jump to content

A certain group of sprites won't even show.


Recommended Posts


I'm new to Phaser, I just started a day ago and it looked pretty interesting, But lately I've been having some problems with certain sprites that will break the game if I try to add them as an animation (will go into a black screen as soon as starting), and if i try to stop all animations and start the game with no animations, trying to see the sprite at least frozen, the game will just show any other sprite on the list avoiding the 'broken' sprite.

I'm using a JsonHash from TexturePacker (the trial version)

	"frame": {"x":113,"y":2,"w":38,"h":48},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":38,"h":48},
	"sourceSize": {"w":38,"h":48}
	"frame": {"x":112,"y":110,"w":39,"h":46},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":39,"h":46},
	"sourceSize": {"w":39,"h":46}
	"frame": {"x":2,"y":54,"w":39,"h":52},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":39,"h":52},
	"sourceSize": {"w":39,"h":52}
	"frame": {"x":43,"y":165,"w":33,"h":51},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":33,"h":51},
	"sourceSize": {"w":33,"h":51}
	"frame": {"x":2,"y":2,"w":64,"h":49},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":64,"h":49},
	"sourceSize": {"w":64,"h":49}
	"frame": {"x":69,"y":2,"w":41,"h":49},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":41,"h":49},
	"sourceSize": {"w":41,"h":49}
	"frame": {"x":77,"y":110,"w":32,"h":52},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":32,"h":52},
	"sourceSize": {"w":32,"h":52}

Here's part of the Json, the sprites that wont work are the "batk/**".

And the meta

"meta": {
	"app": "http://www.codeandweb.com/texturepacker",
	"version": "1.0",
	"image": "Kenshin.png",
	"format": "RGBA8888",
	"size": {"w":237,"h":218},
	"scale": "1",
	"smartupdate": "$TexturePacker:SmartUpdate:5c2cc8f899f401916073813f8a57c05c:859f44caf8d84d1347ca0147886ae398:b98d3e23e0675afb80a9fc68a5d2d511$"

I remade the Json and the png and still the same sprites won't work.

KenshinChar = game.add.sprite(36, game.world.height - 120, 'Kenshin', 'batk/03');

Tried to start the game with a bg and basically just one of the sprites, without animation and it avoided the sprite showing the first sprite of the Json.

Here's the whole png.


and these are the ones that won't work.


I'm just trying the framework so I borrowed some sprites from a certain ds game.

I have absolutely no idea what's happening, sorry if it's something dumb I'm missing.

Edited by HzDev
Link to comment
Share on other sites

Well, what do you want me to show you?

Here's the preload

        function preload() {
           game.load.image('sky', 'assets/sky.png');
           game.load.image('ground', 'assets/platform.png');
           game.load.atlasJSONHash('Kenshin', 'assets/Kenshin.png', 'assets/Kenshin.json');

and here's the creation of the sprite and add the animations.

    KenshinChar = game.add.sprite(36, game.world.height - 120, 'Kenshin', 'walk/09');


    KenshinChar.body.gravity.y = 500;
    KenshinChar.body.collideWorldBounds = true;

    KenshinChar.animations.add('walk', Phaser.Animation.generateFrameNames('walk/', 1, 8, '', 2), 10, true, false);
    KenshinChar.animations.add('jumpup', Phaser.Animation.generateFrameNames('jump/', 2, 3, '', 2), 8, true, false);
    KenshinChar.animations.add('jumpdown', Phaser.Animation.generateFrameNames('jump/', 4, 5, '', 2), 10, true, false);
    KenshinChar.animations.add('jumptwo', Phaser.Animation.generateFrameNames('jump/', 7, 8, '', 2), 10, false, false);
    KenshinChar.animations.add('stand', Phaser.Animation.generateFrameNames('stand/', 1, 4, '', 2), 10, true, false);
    //KenshinChar.animations.add('batk', Phaser.Animation.generateFrameNames('batk/', 1, 4, '', 2), 10, false, false);

The game runs perfectly fine until I add the batk animation. Just deleting the '//' is enough to break the game.

Console errors? I'm working with Sublime Text and trying the game on a local host server on chrome so I didn't know there was a console? how do I show it?

Link to comment
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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...