1 decade ago by MikeD
I'm trying to get the Box 2D plugin into a game I had started. At the moment when I try to load the game I get an error in entity.js at line 31, Cannot call method 'CreateBody' of undefined.
My main.js starts:
I have two entities, the first starts:
and the other:
I created a new level which has a row of tiles at the bottom and one each of the two entities.
I'm doing something wrong, but I can't see it for looking.
Any ideas?
My main.js starts:
ig.module( 'game.main' ) .requires( 'impact.game', 'game.levels.tutorial3', 'game.entities.bunny', 'game.entities.spikes', 'plugins.box2d.game' ) .defines(function(){ MyGame = ig.Box2DGame.extend({ gravity: 100,
I have two entities, the first starts:
ig.module( 'game.entities.bunny' ) .requires( 'impact.entity', 'plugins.box2d.entity' ) .defines(function(){ EntityBunny = ig.Box2DEntity.extend({ animSheet: new ig.AnimationSheet( 'media/BunnySprite.png', 50, 50 ), size: {x: 50, y:50}, flip: false, idleTimer: null, idle: true, idleDelay: 3, startPosition: null, type: ig.Entity.TYPE.A, checkAgainst: ig.Entity.TYPE.NONE, collides: ig.Entity.COLLIDES.NEVER,
and the other:
ig.module( 'game.entities.spikes' ) .requires( 'plugins.box2d.entity' ) .defines(function(){ EntitySpikes = ig.Box2DEntity.extend({ animSheet: new ig.AnimationSheet( 'media/spikes.png', 50, 50 ), size: {x: 50, y:50}, type: ig.Entity.TYPE.B, checkAgainst: ig.Entity.TYPE.A, collides: ig.Entity.COLLIDES.NEVER,
I created a new level which has a row of tiles at the bottom and one each of the two entities.
I'm doing something wrong, but I can't see it for looking.
Any ideas?