Player/Unit animations issue

Place to get help with not working mods / modding interface.
kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

Player/Unit animations issue

Post 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}
}
},

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Player/Unit animations issue

Post 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.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Player/Unit animations issue

Post by Nexela »

I was gonna say the same thing but mine would have been a total guess :)

kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

Re: Player/Unit animations issue

Post 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

kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

Re: Player/Unit animations issue

Post 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.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Player/Unit animations issue

Post by aubergine18 »

It might be worth asking Teralink to see if he(?) knows as he recently did a detailed camper van vehicle animation link
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

Re: Player/Unit animations issue

Post 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?

Post Reply

Return to “Modding help”