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 industrialradio

ig.module(
	'game.entities.werewolf'
)
.requires(
	'impact.entity'
)
.defines(function(){

EntityWerewolf = ig.Entity.extend({
animSheet: new ig.AnimationSheet( 'media/werewolf.png', 50, 100 ),
size: {x: 50, y: 100},
maxVel: {x: 100, y: 100},
offset: {x: 4, y: 2},
flip: false,
health: 10,
type: ig.Entity.TYPE.B,
checkAgainst: ig.Entity.TYPE.A,
collides: ig.Entity.COLLIDES.PASSIVE,

check: function( other ) {
	other.receiveDamage( 10, this );
},

init: function( x, y, settings ) {
	this.parent( x, y, settings );	
	this.addAnim( 'crawl', 0.08, [0,1,2,3] );
},

update: function() {
	// near an edge? return!
	if( !ig.game.collisionMap.getTile(
		this.pos.x + (this.flip ? +4 : this.size.x -4),
			this.pos.y + this.size.y+1
		)
	) {
		this.flip = !this.flip;
	}
	var xdir = this.flip ? -1 : 1;
	this.vel.x = this.speed * xdir;	
	this.parent();
},


handleMovementTrace: function( res ) {
	this.parent( res );
		
	// collision with a wall? return!
	if( res.collision.x ) {
		this.flip = !this.flip;
	}
},

	
});
});

1 decade ago by dominic

What do you mean with "wont load in game"? Does the game finish loading? Does the game start?

Is there an error message in your browser&039;s console? How did you spawn the entity in your game? Is it in a level file or added through code (i.e. with #ig.game.spawnEntity())?

1 decade ago by industrialradio

I created a werewolf.js file put it in the entities folder call it in the main.js under .requires
with game.entities.werewolf

ig.module( 
	'game.main' 
)
.requires(
	'impact.game',
	'impact.font',
	'game.entities.player',
	'game.levels.level1',
	'game.entities.werewolf'
	
)

1 decade ago by industrialradio

but the game does load all the way and i can place as many as i want in weltmeister but they wont show up in game

1 decade ago by industrialradio

I got it too work thanks for writing me I'm sure I'll have more questions
Page 1 of 1
« first « previous next › last »