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 TrexKikBut

I have an entity pretty far away from where the play spawns, and it seems that if its far away, it doesn't load correctly and collision is messed up, but if I put the entity close to the spawn, that one works perfectly, but the one far away doesn't work.


Why is this happening and how do I fix it?

1 decade ago by TrexKikBut

Here is the code:

ig.module(
	'game.entities.breakwall'
)
.requires( 
	'impact.entity'
)
.defines(function(){
	EntityBreakwall = ig.Entity.extend({
		
		animSheet: new ig.AnimationSheet( 'media/brick.png', 16,16),
		size: {x: 16, y: 16},
		offset: {x: 0, y:0},
		maxVel: {x:0, y:0},
		type: ig.Entity.TYPE.NONE,
   		checkAgainst: ig.Entity.TYPE.B,
    	collides: ig.Entity.COLLIDES.FIXED,
		//zombiesLeft: null,
		
		
		init: function( x, y, settings ) {
			this.parent( x, y, settings );
            this.addAnim('idle', 1, [0]);	
        },
		
		update: function() {
			thezombiesLeft = ig.game.zombiesLeft;
			console.log(thezombiesLeft);
			if( zombiesLeft <= 0){
				this.kill();	
			}
			this.parent();
		},
		
		kill: function(){
		this.parent();
		ig.game.spawnEntity(EntityDeathExplosion, this.pos.x, this.pos.y, {colorOffset: 3});			

	}
			
	});
});

1 decade ago by dominic

Your code looks alright.

What do you mean with "doesn't load correctly"? Is there an error message in your browser's console?

Can you upload the game somewhere so we can have a look?

1 decade ago by TrexKikBut

Nevermind, I got it working. Thanks though.
Page 1 of 1
« first « previous next › last »