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: 8559
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
				"animFrameDuration":40,								      - animation case: the time each image is shown (milli sec)
				"animLoopCount":0,				                                              - animation case: how much time to play the 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",	
			"postAnimIdString": "SPRITE_EXPLOSION",			                            - you can set another sprite that should be played on the end of this sprite anumation (like an explosion after the cannonball reach target)
			"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)

Stratego (dev)
Site Admin
Posts: 8559
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Sprites and Textures

Post by Stratego (dev) » Wed Dec 12, 2018 11:29 pm

new values can be set on textures

Code: Select all

...
				"animFrameDuration":40,								      - animation case: the time each image is shown (milli sec)
				"animLoopCount":0,				                                              - animation case: how much time to play the animation
...

Stratego (dev)
Site Admin
Posts: 8559
Joined: Fri Apr 25, 2014 9:28 pm

Re: Game definition jsons - Sprites and Textures

Post by Stratego (dev) » Mon Apr 29, 2019 5:59 pm

new option for sprites:
"postAnimIdString": "SPRITE_EXPLOSION",


you can set anoher sprite that should be played on the end of this sprite (like an explosion after the cannonball reach target)


available for all games AOF/AOW/AOS
now i use it to have explosion for AOW tanks and ship attacks - target ill get an explision animation when the bullet reaches target.

Post Reply

Return to “Game Definition .JSON”