diff --git a/data/sprites/fallback.sprite b/data/sprites/fallback.sprite new file mode 100644 index 0000000..7bef588 --- /dev/null +++ b/data/sprites/fallback.sprite @@ -0,0 +1,14 @@ +{ + +"fallback" : { + "_comment" : "This is the fallback sprite that are used if the game request a sprite not in any file", + "texture" : "fallback", + "topx" : 0, + "topy" : 0, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 1 +} + +} diff --git a/data/sprites/humans.sprite b/data/sprites/humans.sprite index 6fd2ff9..a7bf020 100644 --- a/data/sprites/humans.sprite +++ b/data/sprites/humans.sprite @@ -1,428 +1,409 @@ { - -"fallback" : { - "_comment" : "This is the fallback sprite that are used if the game request a sprite not in any file", - "texture" : "fallback", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 1 -}, - -"male_walkcycle_N" : { - "texture" : "male_walkcycle", - "topx" : 64, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_walkcycle_W" : { - "texture" : "male_walkcycle", - "topx" : 64, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_walkcycle_S" : { - "texture" : "male_walkcycle", - "topx" : 64, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_walkcycle_E" : { - "texture" : "male_walkcycle", - "topx" : 64, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_standing_N" : { - "texture" : "male_walkcycle", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_standing_W" : { - "texture" : "male_walkcycle", - "topx" : 0, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_standing_S" : { - "texture" : "male_walkcycle", - "topx" : 0, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_standing_E" : { - "texture" : "male_walkcycle", - "topx" : 0, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_spellcast_N" : { - "texture" : "male_spellcast", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_spellcast_W" : { - "texture" : "male_spellcast", - "topx" : 0, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_spellcast_S" : { - "texture" : "male_spellcast", - "topx" : 0, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_spellcast_E" : { - "texture" : "male_spellcast", - "topx" : 0, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_slash_N" : { - "texture" : "male_slash", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_slash_W" : { - "texture" : "male_slash", - "topx" : 0, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_slash_S" : { - "texture" : "male_slash", - "topx" : 0, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"male_slash_E" : { - "texture" : "male_slash", - "topx" : 0, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -} - -, - -"male_hurt_S" : { - "texture" : "male_hurt", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_walkcycle_N" : { - "texture" : "female_walkcycle", - "topx" : 64, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_walkcycle_W" : { - "texture" : "female_walkcycle", - "topx" : 64, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_walkcycle_S" : { - "texture" : "female_walkcycle", - "topx" : 64, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_walkcycle_E" : { - "texture" : "female_walkcycle", - "topx" : 64, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 8, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_standing_N" : { - "texture" : "female_walkcycle", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_standing_W" : { - "texture" : "female_walkcycle", - "topx" : 0, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_standing_S" : { - "texture" : "female_walkcycle", - "topx" : 0, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_standing_E" : { - "texture" : "female_walkcycle", - "topx" : 0, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 1, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_spellcast_N" : { - "texture" : "female_spellcast", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_spellcast_W" : { - "texture" : "female_spellcast", - "topx" : 0, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_spellcast_S" : { - "texture" : "female_spellcast", - "topx" : 0, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_spellcast_E" : { - "texture" : "female_spellcast", - "topx" : 0, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 7, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -} - -, - -"female_slash_N" : { - "texture" : "female_slash", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_slash_W" : { - "texture" : "female_slash", - "topx" : 0, - "topy" : 64, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_slash_S" : { - "texture" : "female_slash", - "topx" : 0, - "topy" : 128, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -}, - -"female_slash_E" : { - "texture" : "female_slash", - "topx" : 0, - "topy" : 192, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -} - -, - -"female_hurt_S" : { - "texture" : "female_hurt", - "topx" : 0, - "topy" : 0, - "height" : 64, - "width" : 64, - "number_of_frames" : 6, - "frame_time" : 100, - "originx" : 32, - "originy" : 50 -} - +"male_walkcycle_N" : { +"texture" : "male_walkcycle", +"topx" : 64, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_walkcycle_W" : { +"texture" : "male_walkcycle", +"topx" : 64, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_walkcycle_S" : { +"texture" : "male_walkcycle", +"topx" : 64, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_walkcycle_E" : { +"texture" : "male_walkcycle", +"topx" : 64, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_standing_N" : { +"texture" : "male_walkcycle", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_standing_W" : { +"texture" : "male_walkcycle", +"topx" : 0, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_standing_S" : { +"texture" : "male_walkcycle", +"topx" : 0, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_standing_E" : { +"texture" : "male_walkcycle", +"topx" : 0, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_spellcast_N" : { +"texture" : "male_spellcast", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_spellcast_W" : { +"texture" : "male_spellcast", +"topx" : 0, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_spellcast_S" : { +"texture" : "male_spellcast", +"topx" : 0, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_spellcast_E" : { +"texture" : "male_spellcast", +"topx" : 0, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_slash_N" : { +"texture" : "male_slash", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_slash_W" : { +"texture" : "male_slash", +"topx" : 0, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_slash_S" : { +"texture" : "male_slash", +"topx" : 0, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_slash_E" : { +"texture" : "male_slash", +"topx" : 0, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"male_hurt_S" : { +"texture" : "male_slash", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_walkcycle_N" : { +"texture" : "female_walkcycle", +"topx" : 64, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_walkcycle_W" : { +"texture" : "female_walkcycle", +"topx" : 64, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_walkcycle_S" : { +"texture" : "female_walkcycle", +"topx" : 64, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_walkcycle_E" : { +"texture" : "female_walkcycle", +"topx" : 64, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 8, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_standing_N" : { +"texture" : "female_walkcycle", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_standing_W" : { +"texture" : "female_walkcycle", +"topx" : 0, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_standing_S" : { +"texture" : "female_walkcycle", +"topx" : 0, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_standing_E" : { +"texture" : "female_walkcycle", +"topx" : 0, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 1, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_spellcast_N" : { +"texture" : "female_spellcast", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_spellcast_W" : { +"texture" : "female_spellcast", +"topx" : 0, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_spellcast_S" : { +"texture" : "female_spellcast", +"topx" : 0, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_spellcast_E" : { +"texture" : "female_spellcast", +"topx" : 0, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 7, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_slash_N" : { +"texture" : "female_slash", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_slash_W" : { +"texture" : "female_slash", +"topx" : 0, +"topy" : 64, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_slash_S" : { +"texture" : "female_slash", +"topx" : 0, +"topy" : 128, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_slash_E" : { +"texture" : "female_slash", +"topx" : 0, +"topy" : 192, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} +, +"female_hurt_S" : { +"texture" : "female_slash", +"topx" : 0, +"topy" : 0, +"height" : 64, +"width" : 64, +"number_of_frames" : 6, +"frame_time" : 100, +"originx" : 32, +"originy" : 50 +} } diff --git a/extra/scripts/build_sprites.sh b/extra/scripts/build_sprites.sh index d1dc393..3846907 100755 --- a/extra/scripts/build_sprites.sh +++ b/extra/scripts/build_sprites.sh @@ -5,3 +5,6 @@ cd ../.. pushd data/textures/lpc_womens_shirts python3 generate_sprite.py blouse corset long-sleeve_blouse long-sleeve_shirt pirate_shirt scoop_neck sleeveless_shirt > ../../sprites/female_shirts.sprite popd +pushd extra/scripts/python +python3 create_human_sprite.py +popd \ No newline at end of file diff --git a/extra/scripts/python/common/directional_sprite.py b/extra/scripts/python/common/directional_sprite.py new file mode 100644 index 0000000..edb8932 --- /dev/null +++ b/extra/scripts/python/common/directional_sprite.py @@ -0,0 +1,35 @@ + +import sys + + +DIRECTIONS = ['N','W','S','E'] + + +def print_sprite_direction(race, animation, name, texture, topY=0, topX=0, number_of_frames=1, frame_time=100, file=sys.stdout, direction="S"): + name_part = "" + if name: + name_part = name+"_" + print("\""+race+"_"+animation+"_"+name_part+direction+"\" : {", file=file) + print("\"texture\" : \""+texture+"\",", file=file) + print("\"topx\" : "+str(topX)+",", file=file) + print("\"topy\" : "+str(topY)+",", file=file) + print("\"height\" : 64,", file=file) + print("\"width\" : 64,", file=file) + print("\"number_of_frames\" : "+str(number_of_frames)+",", file=file) + print("\"frame_time\" : 100,", file=file) + print("\"originx\" : 32,", file=file) + print("\"originy\" : 50", file=file) + print("}", file=file) + +def print_sprite(race, animation, name, texture, topY=0, topX=0, number_of_frames=1, frame_time=100, file=sys.stdout): + first = True + for direction in DIRECTIONS: + if first: + first = False + else: + print(",", file=file) + print_sprite_direction(race, animation, name, texture, topY, topX, number_of_frames, frame_time, file, direction) + topY += 64 + + + diff --git a/extra/scripts/python/create_human_sprite.py b/extra/scripts/python/create_human_sprite.py new file mode 100644 index 0000000..dc49e6f --- /dev/null +++ b/extra/scripts/python/create_human_sprite.py @@ -0,0 +1,26 @@ + + +import common.directional_sprite +import sys + +def print_male(race="male", file=sys.stdout): + common.directional_sprite.print_sprite(race=race, animation="walkcycle", name=None, texture=race+"_walkcycle", topX=64, topY=0, number_of_frames=8, file=file) + print(",", file=file) + common.directional_sprite.print_sprite(race=race, animation="standing", name=None, texture=race+"_walkcycle", topY=0, number_of_frames=1, file=file) + print(",", file=file) + common.directional_sprite.print_sprite(race=race, animation="spellcast", name=None, texture=race+"_spellcast", topY=0, number_of_frames=7, file=file) + print(",", file=file) + common.directional_sprite.print_sprite(race=race, animation="slash", name=None, texture=race+"_slash", topY=0, number_of_frames=6, file=file) + print(",", file=file) + common.directional_sprite.print_sprite_direction(race=race, animation="hurt", name=None, texture=race+"_slash", topY=0, number_of_frames=6, file=file) + + +def main(): + with open('../../../data/sprites/humans.sprite', 'w') as file: + print("{", file=file) + print_male(file=file) + print(",", file=file) + print_male("female", file=file) + print("}", file=file) + +main() \ No newline at end of file