Game definition jsons - Sprites and Textures

Learn the .json format
used to define characteristics of units and other game elements
Post Reply
Stratego (dev)
Site Admin
Posts: 6721
Joined: Fri Apr 25, 2014 9:28 pm

Game definition jsons - Sprites and Textures

Post by Stratego (dev) » Tue Sep 12, 2017 8:18 pm

Here is the "sprites and textures definition" json: graphics.json


there are two listst:
- sprites (includes its own texture) - used for eg. projectiles (flying arrow) or spot animations (fireball explosion)
- textures - used for action icons, button images, indicator images

Code: Select all


{
	"sprites": [                                  
		{			
			"idString": "SPRITE_SPELL_SPOT_ANIM_SWORD_WHIRLWIND",                    - sprite name
			"addRotation": 0.50f,                                                                              - base rotation (eg. arrow direction)
			"onLayer": "HIGHLIGHT",			                                                     
			"texture": { 
				"imgName": "96_anim_action_sword_whirlwind.png",                        - image asset filename
				"cropToRect": {"bottom": 20,"left": 10,"right": 20,"top": 10},               - you can cut a part of it to be the texture.
				"imgColumns": 4,                                                                             - 1 = single image, more: animation
				"withColoring": false,                                                                       - if it is a "player color" relevant image
				"soundPackIdString": "SOUND_PACK_WHIRLWIND_ATTACK"                 - in case of spot animation  - this can be the sound of animation. (fireball explosion )
			}
		},
		{			
			"idString": "SPRITE_ACTION_CANNONBALL",                                             - these are the individual textures (being no sprites), the definition is exactly same as above the texture within the sprite case.
			"addRotation": 0f,
			"onLayer": "HIGHLIGHT",			
			"texture": { 
			        "idString": "TEXTURE_ACTION_CANNONBALL",
				"imgName": "32_arrow_cannon_ball.png",
				"imgColumns": 1,
				"withColoring": false,
				"soundPackIdString": "SOUND_PACK_WHIRLWIND_ATTACK"
				 
			}
		}

	],
	"textures": [
		{
			"idString": "XXTEXTURE_ACTION_CANNONBALL",
			"imgColumns": 1,
			"imgName": "32_arrow_cannon_ball.png",
			"soundPackIdString": "SOUND_UNIT_ATTACK_CANNON",			
			"withColoring": false
		}
	]
	
	
	
	
}

you can reference the texture and sprite "idString" in other jsons (eg. in effects.json)

Post Reply

Return to “Game Definition .JSON”