07-22-2016, 09:19 PM
(This post was last modified: 07-22-2016, 09:25 PM by Fire and Ice.)
(07-22-2016, 07:31 AM)A-Man Wrote:Amadis Wrote:Can't wait to see a Sneak Peek at the Data system. ( I actually can wait XD )To give you an idea, JSON looks like this:
With LF2 DC, it'll will probably look something like this:Code:{
parent: {
tag0: "", tag1: "", tag2: "",
child: {
tag0: "", tag1: "", tag2: ""
}
}
}
Code:{
frame: { id: 0,
pic: 0, state: "standing", wait: 2, next: 1,
itr: {
x: 0, y: 0, w: 10, h: 10
}
}
}
Close, but we actually use a "frameset" concept for simplification.
Here is a real example -
Code:
{
"name":"Danny",
"spritesheets":[
{"index":0, "frame_width":256, "frame_height":256, "rows":8, "cols":8},
{"index":1, "frame_width":256, "frame_height":256, "rows":8, "cols":8}
],
"walk_speed":2.4,
"run_speed":6.2,
"jump_height":12.0,
"armor":1.0,
"audio":[],
"framesets":[
{"state":"stand", "sprite_index":0,
"first_frame":0, "num_frames":4,
"framerate":10, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"walk", "sprite_index":0,
"first_frame":4, "num_frames":4,
"framerate":10, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"run", "sprite_index":0,
"first_frame":16, "num_frames":5,
"framerate":22, "playback":true,
"audio_frames":[{"frame":16, "clip":"run_step_1"}, {"frame":20, "clip":"run_step_2"}],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"run_attack", "sprite_index":1,
"first_frame":29, "num_frames":5,
"framerate":10, "move_speed":2.4,
"audio_frames":[{"frame":31, "clip":"attack_1"}],
"damage_frames":[
{"frame":31, "hit_x":64, "hit_y":28, "hit_width":120, "hit_height":166, "damage":30, "push_back":2.4, "knock_over":true},
{"frame":32, "hit_x":64, "hit_y":28, "hit_width":120, "hit_height":166, "damage":30, "push_back":2.4, "knock_over":true}
],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"roll", "sprite_index":0,
"first_frame":21, "num_frames":3,
"audio_frames":[{"frame":21, "clip":"whoosh"}],
"framerate":8},
{"state":"start_jump", "sprite_index":0,
"first_frame":56, "num_frames":1,
"framerate":12,
"audio_frames":[{"frame":56, "clip":"jump"}],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"jump", "sprite_index":0,
"first_frame":57, "num_frames":1,
"framerate":12, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"jump_attack", "sprite_index":1,
"first_frame":24, "num_frames":5,
"framerate":12,
"audio_frames":[{"frame":25, "clip":"attack_2"}],
"damage_frames":[
{"frame":26, "hit_x":128, "hit_y":72, "hit_width":128, "hit_height":184, "damage":25, "push_back":0, "knock_over":true},
{"frame":27, "hit_x":128, "hit_y":72, "hit_width":128, "hit_height":184, "damage":25, "push_back":0, "knock_over":true}
],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"end_jump", "sprite_index":0,
"first_frame":56, "num_frames":1,
"audio_frames":[{"frame":56, "clip":"landed"}],
"framerate":12,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"end_dash", "sprite_index":0,
"first_frame":56, "num_frames":1,
"audio_frames":[{"frame":56, "clip":"landed"}],
"framerate":12,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"start_dash", "sprite_index":0,
"first_frame":56, "num_frames":1,
"framerate":64,
"audio_frames":[{"frame":56, "clip":"dash"}],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"dash", "sprite_index":0,
"first_frame":58, "num_frames":1,
"framerate":12, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"back_dash", "sprite_index":0,
"first_frame":59, "num_frames":1,
"framerate":12, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"dash_attack", "sprite_index":1,
"first_frame":24, "num_frames":5,
"framerate":12,
"audio_frames":[{"frame":25, "clip":"attack_2"}],
"damage_frames":[
{"frame":26, "hit_x":128, "hit_y":72, "hit_width":128, "hit_height":184, "damage":25, "push_back":0, "knock_over":true},
{"frame":27, "hit_x":128, "hit_y":72, "hit_width":128, "hit_height":184, "damage":25, "push_back":0, "knock_over":true}
],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"attack_1", "sprite_index":0,
"first_frame":8, "num_frames":4,
"framerate":12, "move_speed":0.2,
"audio_frames":[{"frame":9, "clip":"attack_1"}],
"damage_frames":[
{"frame":9, "hit_x":128, "hit_y":108, "hit_width":128, "hit_height":148, "damage":10, "push_back":0.3}
],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"attack_2", "sprite_index":0,
"first_frame":12, "num_frames":4,
"framerate":12, "move_speed":0.2,
"audio_frames":[{"frame":13, "clip":"attack_2"}],
"damage_frames":[
{"frame":13, "hit_x":128, "hit_y":108, "hit_width":128, "hit_height":148, "damage":10, "push_back":0.3}
],
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"attack_launch", "sprite_index":1,
"first_frame":34, "num_frames":2,
"framerate":10,
"next_state":"attack_launch_2",
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"attack_launch_2", "sprite_index":1,
"first_frame":36, "num_frames":3,
"framerate":10, "move_speed":3.6,
"audio_frames":[{"frame":36, "clip":"attack_1"}],
"damage_frames":[
{"frame":36, "hit_x":128, "hit_y":36, "hit_width":128, "hit_height":220, "damage":20, "push_back":2.4, "knock_over":true},
{"frame":37, "hit_x":128, "hit_y":36, "hit_width":128, "hit_height":220, "damage":20, "push_back":2.4, "knock_over":true},
{"frame":38, "hit_x":128, "hit_y":36, "hit_width":128, "hit_height":220, "damage":20, "push_back":2.4, "knock_over":true}
],
"next_state":"attack_launch_3",
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"attack_launch_3", "sprite_index":1,
"first_frame":39, "num_frames":4,
"framerate":16, "move_speed":0.8,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"defend", "sprite_index":0,
"first_frame":51, "num_frames":1,
"framerate":12,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"defend_hurt", "sprite_index":0,
"first_frame":52, "num_frames":1,
"framerate":6,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"hurt", "sprite_index":0,
"first_frame":24, "num_frames":1,
"framerate":3,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"hurt_2", "sprite_index":0,
"first_frame":32, "num_frames":1,
"framerate":3,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"stunned", "sprite_index":0,
"first_frame":24, "num_frames":4,
"framerate":3,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"defend_broken", "sprite_index":0,
"first_frame":53, "num_frames":3,
"framerate":3,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"fall_back", "sprite_index":0,
"first_frame":32, "num_frames":3,
"framerate":10,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"falling_back", "sprite_index":0,
"first_frame":35, "num_frames":1,
"framerate":10, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"fall_back_end", "sprite_index":0,
"first_frame":36, "num_frames":2,
"audio_frames":[{"frame":36, "clip":"fall_ground"}],
"framerate":14},
{"state":"down_back", "sprite_index":0,
"first_frame":36, "num_frames":1,
"audio_frames":[{"frame":36, "clip":"fall_ground"}],
"framerate":8, "playback":true},
{"state":"fall_forward", "sprite_index":0,
"first_frame":24, "num_frames":3,
"framerate":10,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"falling_forward", "sprite_index":0,
"first_frame":27, "num_frames":1,
"framerate":10, "playback":true,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192},
{"state":"fall_forward_end", "sprite_index":0,
"first_frame":28, "num_frames":2,
"audio_frames":[{"frame":28, "clip":"fall_ground"}],
"framerate":14},
{"state":"down_forward", "sprite_index":0,
"first_frame":28, "num_frames":1,
"audio_frames":[{"frame":28, "clip":"fall_ground"}],
"framerate":8, "playback":true},
{"state":"get_up", "sprite_index":0,
"first_frame":56, "num_frames":1,
"audio_frames":[{"frame":64, "clip":"landed"}],
"framerate":12,
"collision_x":84, "collision_y":64,
"collision_width":80, "collision_height":192}
]
}
For specials it's also easy, to implement Defend Forward Attack you implement a frameset with "state":"dfa"
We also support the following parameters to accept a state to go to - press_d, press_a, press_j, press_b (back), next_state