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 coreysnyder

Here's my Entity:
ig.module(
	'game.entities.AnimateStar'
)
.requires(
	'impact.entity'
)
.defines(function(){
		EntityAnimateStar = ig.Entity.extend({
			animSheet: new ig.AnimationSheet("media/web/star.png", 35, 35),
			size: {x:35, y:35},
			offset: {x: 0, y:0},
			gravityFactor : 0, // wont fall due to gravity
			_wmIgnore: true,

			init: function(x, y, settings){
				this.parent(x, y, settings);
                               console.log("INIT: EntityAnimateStar");
				this.addAnim('idle', 1, [0]);
			},

			update: function(){

                               console.log("UPDATE");
				this.parent();

			},

            kill: function(){
                console.log("KILL");
                this.parent();
            },
	   draw: function(){
                   console.log("draw");
                   this.parent();

			}
		});
	});

I want this star entity to be drawn to the screen. So in my games init function I call:
ig.game.spawnEntity( EntityAnimateStar, 40, 30, {order: 1} )

I see the log on INIT but not on draw, update, or kill. And I don't see this item drawn to the screen. Any ideas what I'm overlooking?

1 decade ago by Joncom

Hi Corey.

Is your main.js update function missing this.parent();?
Page 1 of 1
« first « previous next › last »