0

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

fabstao
  • 9
  • 1
  • 6

1 Answers1

0

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")...
mucaho
  • 2,119
  • 20
  • 35
  • Thanks! I already declared the objects in another file named components.js: Crafty.c('blaster', { init: function() { this.requires('Actor, Color, Solid, Gravity, Collision, Tween') – fabstao Mar 29 '16 at 21:05
  • Crafty.c('Actor', { init: function() { this.requires('2D, DOM'); }, }); – fabstao Mar 29 '16 at 21:06
  • @FNode So does that resolve the issue or does it still not work in Cordova? – mucaho Mar 30 '16 at 23:01
  • It solves the gravity issue, I´m having issues with scene and tween but it seems a collision issue thanks! – fabstao Apr 11 '16 at 01:02