Search code examples
androidcordovacraftyjs

Cordova update and lost craftyjs' tween and gravity


I'm trying to update a mobile Cordova game to the following versions:

/** * craftyjs 0.7.0 * http://craftyjs.com/

Cordova:

{ name: 'cordova', description: 'Cordova command line interface tool', 'dist-tags': { latest: '6.0.0',

I lost .gravity() and .tween()

I checked Craftyjs documentation and my code looks ok:

Crafty.e("phaser")
    .attr({
             x: (this.x+18),
             y: this.y,
             w: 8,
             h: 12
           })
             .tween({alpha: 0.0, x: (this.x+18), y: -1},1250);
           });

and:

Crafty.e("blaster")
    .attr({
             x: der,
             y: 10,
             w: 8,
             h: 12
           })
             .gravityConst(0.04)
             .gravity("floor");

Any hints?

Thanks and regards


Solution

  • I don't know about Cordova integration, but you are calling methods that haven't yet been added to your entities.
    Adding the respective Tween & Gravity components to your entities should solve the issue:

    Crafty.e("2D, Tween, phaser")...
    Crafty.e("2D, Gravity, blaster")...