Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by fulvio

In my main.js I&039;m trying to animate the first tile of my tileset, which is #160x208 in dimensions.

This is what I have so far. It&039;s before the #this.loadLevel() according to the [documentation http://impactjs.com/documentation/class-reference/game#backgroundanims].

init: function() {
    var as = new ig.AnimationSheet('media/tiles/lavatiles16x16.png', 16, 16);
        this.backgroundAnims = {
        'media/tiles/lavatiles16x16.png': {
            0: new ig.Animation(as, 0.13, [1, 2, 3, 4, 5, 6, 7, 8])
        }
    };
    ...
    this.loadLevel(Level1);
}

It doesn't seem to be working at all, I don't see any animations using the first level tile.

1 decade ago by fulvio

Okay, I just figured out the problem was with my saved tileset, I was accidentally referring to a 320x416 tileset by accident and it was saved as lavatiles16x16.png.

1 decade ago by fulvio

I just noticed that this.backgroundAnims only seems to work on the main layer. If I use the same tile on a different layer it doesn't seem to be working. Is there a way around this?

1 decade ago by fulvio

Looks like it's working on other layers now as well, that's strange.

I would however like to be able to modify the sequence during runtime.

My animations are lava animating, but I'd like to randomise the sequence. Is this possible to do as part of something that is initialised and not sitting inside an update loop?

1 decade ago by TigerJ

you could randomize the interval with something like

Math.floor((Math.random()*3)+13)/100);

(this would give you a range between .13 and .15)

This might not work though since you have only 1 anim to init...

It may be easier to make a couple tiles that start at different frames instead of code the difference.
Page 1 of 1
« first « previous next › last »