Page 1 of 1

Player/Unit animations issue

Posted: Fri Sep 09, 2016 4:06 am
by kyranzor
I am having issues with animation sprite sheets which only have north-east-south sprites, and west is omitted.

West is just a mirror of East, and i'm pretty sure there is a line of lua code i can put in the definition of the entity prototype in the run_animation table, to specify that east-west animations are symmetrical and it's okay to do this.

here is my unit prototype, what can I change to make it NOT look like the unit is "facing east and moon-walking" when moving to the west.

{
type = "unit",
name = "small-creeper",
icon = "__base__/graphics/icons/small-biter.png",
flags = {"placeable-player", "placeable-enemy", "placeable-off-grid", "breaths-air"},
max_health = 25,
order = "b-s-c",
subgroup="enemies",
healing_per_tick = 0.01,
collision_box = {{-0.2, -0.2}, {0.2, 0.2}},
selection_box = {{-0.4, -0.7}, {0.7, 0.4}},
attack_parameters =
{
type = "projectile",
range = 0.5,
cooldown = 35,
ammo_category = "melee",
ammo_type = make_unit_melee_ammo_type(6),
sound = make_biter_roars(0.5),
animation =
{
filename = "__zombies__/graphics/creeper-attack.png",
priority = "high",
width = 63,
height = 96,
direction_count = 9,
frame_count = 15,
axially_symmetrical = true,
animation_speed = 2,
shift = {0, 0}
},
},
vision_distance = 30,
movement_speed = 0.2,
distance_per_frame = 0.1,
pollution_to_join_attack = 200,
distraction_cooldown = 300,
corpse = "",
dying_explosion = "blood-explosion-small",
dying_sound = make_biter_dying_sounds(1.0),
working_sound = make_biter_calls(0.7),
run_animation = {
filename = "__zombies__/graphics/creeper-run.png",
priority = "high",
width = 48,
height = 68,
direction_count = 9,
frame_count = 30,
axially_symmetrical = true,
animation_speed = 2,
shift = {0, 0}
}
},

Re: Player/Unit animations issue

Posted: Fri Sep 09, 2016 4:11 am
by aubergine18
IIRC it's this line that tells the game the East sprite should be the West sprite flipped horizontally:

Code: Select all

axially_symmetrical = true,
In theory, if you set that false, then you get the extra East sprite that you're after.

Re: Player/Unit animations issue

Posted: Fri Sep 09, 2016 7:30 am
by Nexela
I was gonna say the same thing but mine would have been a total guess :)

Re: Player/Unit animations issue

Posted: Fri Sep 09, 2016 2:27 pm
by kyranzor
I think I tried setting it to false, and just removing it totally... I don't think it helped. I did some image editing and just made my own west sprite.

The sprites still don't look correct when the critter is walking around "idle" it is usually looking the wrong way when it's walking around

Re: Player/Unit animations issue

Posted: Sat Sep 10, 2016 2:47 am
by kyranzor
I edited the sprite sheets and added the new directions and in the correct order ( i had the west-facing order reversed) so now the animation is fine. still annoying though, i'd like to know what the correct lua code is to make it correctly replicate east-west animations.

Re: Player/Unit animations issue

Posted: Sat Sep 10, 2016 3:05 am
by aubergine18
It might be worth asking Teralink to see if he(?) knows as he recently did a detailed camper van vehicle animation link

Re: Player/Unit animations issue

Posted: Sat Sep 10, 2016 3:08 am
by kyranzor
maybe i need to set the direction number to 16 even though there are only 9 sprites, because the missing 7 are just the mirrored east/west animations?