Page 1 of 1

Can't Get Animation to Work

Posted: Sat Jun 11, 2016 4:31 am
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?

Re: Can't Get Animation to Work

Posted: Sat Jun 11, 2016 11:50 am
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.

Re: Can't Get Animation to Work

Posted: Sat Jun 11, 2016 4:25 pm
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.

Re: Can't Get Animation to Work

Posted: Sat Jun 11, 2016 8:07 pm
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.

Re: Can't Get Animation to Work

Posted: Sat Jun 11, 2016 8:40 pm
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.

Re: Can't Get Animation to Work

Posted: Mon Jun 13, 2016 6:14 pm
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.