Can't Get Animation to Work

Place to get help with not working mods / modding interface.
Post Reply
ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Can't Get Animation to Work

Post by ledzilla »

I've mostly completed a mod of accumulators, but I'm having trouble with the animation. So far it's only the charging animation, as I haven't tested discharging yet. I created a simple two frame animation file, but it when charging the sprite doesn't change from the normal image. or it is only sticking on a single frame of the animation (one frame is the same as the static image). Here's how I have it right now:

Code: Select all

    charge_animation =
    {
      filename = "__ModdedAccumulators__/graphics/entity/mod-accumulator-mkII-charging.png",
      width = 124,
      height = 103,
      priority = "extra-high",
      line_length = 2,
      frame_count = 2,
      shift = {0.7, -0.2},
      animation_speed = 2,
      run_mode = "forward"
    },
Am I missing something here, or is there something else I need to tinker with?

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Can't Get Animation to Work

Post by Adil »

Well, default accumulators have animation speed of .5, which I'd assume is "change frame every 2 ticks" and following that logic speed 4 would be "skip forward 4 frames on each tick".
Other than that, you might double check, where charge_animation table is nested in parent prototype. Certain fields are optional, and if you mistype a brace somewhere, they might end up in wrong place and be happily ignored by game.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: Can't Get Animation to Work

Post by DedlySpyder »

I know that for lights, when the light is on the game doesn't replace the whole sprite, it only overlays a new bulb on top of the old one. So, assuming accumulators work the same, if you want to change the base sprite you would need something equal size or bigger to cover it up.

ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Re: Can't Get Animation to Work

Post by ledzilla »

Adil wrote:Well, default accumulators have animation speed of .5, which I'd assume is "change frame every 2 ticks" and following that logic speed 4 would be "skip forward 4 frames on each tick".
Other than that, you might double check, where charge_animation table is nested in parent prototype. Certain fields are optional, and if you mistype a brace somewhere, they might end up in wrong place and be happily ignored by game.
Changing the animation speed hasn't had any effect on the problem. And I've been poking at various different values trying to see if I can effect a positive change, but either nothing happens, or I get an error.
DedlySpyder wrote:I know that for lights, when the light is on the game doesn't replace the whole sprite, it only overlays a new bulb on top of the old one. So, assuming accumulators work the same, if you want to change the base sprite you would need something equal size or bigger to cover it up.
Well, the images I'm using are all the same size, but one of the frames in each animation is the same as the default image.

ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Re: Can't Get Animation to Work

Post by ledzilla »

Ok, just for kicks, I decided to tell the animation to run in reverse, and the second frame displayed, but there was no animation. It was not alternating between both frames of the animation.

ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Re: Can't Get Animation to Work

Post by ledzilla »

I tried changing the animation to the following, but it still will only show a single frame:

Code: Select all

    charge_animation =
    {
	  stripes =
	  {
		{
		 filename = "__ModdedAccumulators__/graphics/entity/mod-accumulator-mkII-charging.png",
		 width_in_frames = 2,
		 height_in_frames = 1,
		},
	  },
      width = 124,
      height = 103,
      priority = "extra-high",
      frame_count = 2,
      shift = {0.7, -0.2},
      animation_speed = 1,
      run_mode = "backward"
    },
No matter what I attempt, at best I get one out of two frames of animation.

Post Reply

Return to “Modding help”