Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit 8253e780aedff645944162fd244b50a163453e55
parent 315e986fde23e175fc4a04e5c2d4aa36b444511b
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Fri,  4 Dec 2020 22:44:16 -0600

Added support for flipping in actor orientation

Diffstat:
Mdata/img/actors/jisella/orientation.json | 10+++++-----
Mdata/json/scenes/testscene.json | 11++++++-----
Msrc/scene.py | 2+-
3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/data/img/actors/jisella/orientation.json b/data/img/actors/jisella/orientation.json @@ -1,7 +1,7 @@ { - "base" : [0, 0], - "eyes" : [191, 77], - "brows" : [190, 66], - "mouth" : [204, 115], - "details" : [188, 73] + "base" : [[0, 0], [0, 0]], + "eyes" : [[96, 77], [191, 77]], + "brows" : [[95, 66], [190, 66]], + "mouth" : [[112, 115], [204, 115]], + "details" : [[97, 72], [189, 72]] } diff --git a/data/json/scenes/testscene.json b/data/json/scenes/testscene.json @@ -16,13 +16,14 @@ "characters" : [ { "name" : "jisella", - "flipped" : true, - "pos" : [100, 118], + "flipped" : false, + "pos" : [70, 118], "actor" : [ { "sheet" : "base", "sprite" : [0, 0] }, - { "sheet" : "eyes", "sprite" : [0, 3] }, - { "sheet" : "mouth", "sprite" : [0, 0] }, - { "sheet" : "brows", "sprite" : [0, 0] } + { "sheet" : "eyes", "sprite" : [1, 0] }, + { "sheet" : "mouth", "sprite" : [1, 0] }, + { "sheet" : "brows", "sprite" : [0, 0] }, + { "sheet" : "details", "sprite" : [0, 0] } ] } ], diff --git a/src/scene.py b/src/scene.py @@ -172,7 +172,7 @@ class StillScene(object): nel = [] for a in c["actor"]: ne = entity.Entity(sh[nc_name + "_actor_" + a["sheet"]], tuple(a["sprite"])) - pos = (c["pos"][0] + orient[a["sheet"]][0], c["pos"][1] + orient[a["sheet"]][1]) + pos = (c["pos"][0] + orient[a["sheet"]][int(nc_flip)][0], c["pos"][1] + orient[a["sheet"]][int(nc_flip)][1]) ne.set_position(pos) ne.set_flip(nc_flip) nel.append(ne)