problems with json defining iso objects
Shri

Gio,

I was trying to use the newest version of wade with some older iso stuff I had. Something changed, but I am not sure what. I can get non animated objects to show, but when I modify the scale or offset parameters, it doesn't change the rendered image. Here is the json. If I modify the parameters and rerun, nothing regarding the tree changes ?

{
"tree1Data": 
	{
		"sprites": [
		{
			"image": "./tree1.png",
			"scale": 1.0,
			"offset": {
				"x": 0,
				"y": 0
			}	
		}
		]
	}
}

Also, I can't seem to get animated iso objects to display. They exist (scene objects are not null), but for some reason, the sprites don't display ? The layers are correct, so I know nothing is "drawing over the top of them" ?

{
	"dragonData": 
	{
		"sprites": [
			{
			"animations": [
					{
                        "name": "Idle_iso_ne",
                        "image": "./dragonFly_ne.png",
                        "autoresize": "true",
                        "numCells": {
                            "x": 18,
                            "y": 1
                        },
						"startFrame": 0,
						"endFrame": 17,
                        "speed": 20,
                        "looping": true
                    }
                ],
				"scale": 1.0,
				"offset": {
					"x": 0,
					"y": 0.25
				},
				"sortPoint": {
				"x": 0,
				"y": 0.8
				}
			}
		],
		"behaviors": "IsoCharacter"
	}
}

Everything works fine with older versions of wade, what am I not defining correctly anymore ? If you could post a json file on how to define iso objects to the website, that would be appreciated.

Also, is there a way to define a terrain texture as a sprite, so you could use a shader for iso terrain tiles ?

thanks,

Shri

All 4 Comments
Gio

Hi Shri

Replying from my mobile so I can't really paste any code here, but the important point is that the data structure for the sprites array of isometric objects is now exactly the same as that of regular non-isometric Sprites.

The easiest way to visualize it would be to create an isometric object tile in the editor and look inside the resulting .its file (which is just a json file).

To use a shader on a terrain tile, you can get the sprite after it's been created and call setPixelShader on it. Something like 

wade.iso.getTileSprite(x, z).setPixelShader(shaderSource, shaderUniforms);

I would strongly advise using the same shader on all tiles for performance reasons (switching shaders is an expensive operation)

Shri

Gio,

OK, I checked out the its file and got my iso character to move and animate as expected. However, the size and scale settings are still now working ?

That is, the size of my sprite remains the same no matter which of the two settings I modify. I have attached the json file for you to take a look.

thanks for all your help, cheers,

Shri

Gio

I don't have your image assets, but looking at the json it seems that this could be happening because all your animations have the autoResize property set to true.

This will cause the sprite size to be dictated by the animation spritesheet. Although I'm surprised that changing the "scale" property doesn't work - that should have worked, so there may be a bug to fix there.

Could you try "autoResize": false and see if that works?

By the way, you also have two animations set to active. You probably want only one of them to be active.

Shri

Gio,

I changed autoresize to false, and setting the sprites size now works as expected. Changing the scale parameter doesn't seem to have any effect though ?

I am not redering through webgl (I could not set the forceWebGl flag on init, see my other forum post for that question), so I don't know if this is a canvas only situation or not.

Om a different note, what are the default available iso "states". There are the two Idle & Walk, but were any others added. It seems in the code there is something to do with "_variation", (which before was used for different idle variations), and in your demo the swordsman has an Attack, but do you have to set those specifically (I glossed over your iso demo, so not sure how you set the animation when you killed the sheep in the end)  or is there some model set of states for iso characters you have implemented. If you haven't, that might be a future addition for iso characters. That is to have a state machine that you could define and use to transition iso animations.

Anyway, "come sempre, gratzie per auitare", if you can give me the force web gl answer, I think I have another cool demo/blog I can put together.

cheers,

Shri

Post a reply
Add Attachment
Submit Reply
Login to Reply