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 papyhardcore

Hi,

I started with ImpactJS.
I try to make a small vertical shoot.
I defined a Player class and BulletPlayer class.

My class Player:
http://pastebin.com/i9tVFkaY
My class BulletPlayer:
http://pastebin.com/q6QLsAc0
My main.js
http://pastebin.com/aYCgpitv

When I try to shoot I have this message :

Uncaught ReferenceError: EntityBullet is not defined (00:22:23:442 | error, javascript)
    at ig.Entity.extend.update (public_html/lib/game/entities/Player.js:44:43)
    at (anonymous function) (public_html/lib/impact/impact.js:509:19)
    at ig.Game.ig.Class.extend.updateEntities (public_html/lib/impact/game.js:213:9)
    at ig.Game.ig.Class.extend.update (public_html/lib/impact/game.js:183:8)
    at ig.Game.extend.update (public_html/lib/game/main.js:32:8)
    at (anonymous function) (public_html/lib/impact/impact.js:509:19)
    at ig.Game.ig.Class.extend.run (public_html/lib/impact/game.js:170:8)
    at ig.System.ig.Class.extend.run (public_html/lib/impact/system.js:108:17)
    at animate (public_html/lib/impact/impact.js:436:4)

I do not understand WHY I have this error.
Thx.

1 decade ago by FragOnly

Hello,

You have defined an "EntityBulletPlayer" but in your Player class you have the following:
var bullet = new EntityBulletPlayer();
ig.game.spawnEntity(EntityBullet,this.pos.x, this.pos.y);

Notice that the second line says: "EntityBullet" and not "EntityBulletPlayer"
I wonder if those two lines shouldn't be:
var bullet = ig.game.spawnEntity(EntityBulletPlayer,this.pos.x, this.pos.y);

1 decade ago by papyhardcore

I reread several times all lines of code without seeing this error.
Thank you very much.
Page 1 of 1
« first « previous next › last »