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 fugufish

am trying to build a crate (like in the biolab example), seem to hit a roadblock.

the crate must be able to be shot at by
- the player (TYPE A)
- AND also the enemies (TYPE B)

if I do this:


EntityCrate=ig.Entity.extend({
	type:ig.Entity.TYPE.B, // set as 'Enemy'
	checkAgainst:ig.Entity.TYPE.NONE,
	collides:ig.Entity.COLLIDES.ACTIVE, // must be active, so crates can stack up

EntityPlayerBullet=ig.Entity.extend({
	type:ig.Entity.TYPE.A,  //player is friendly
	checkAgainst:ig.Entity.TYPE.NONE,
	collides:ig.Entity.COLLIDES.PASSIVE,

EntityEnemyBullet=ig.Entity.extend({
	type:ig.Entity.TYPE.NONE,
	checkAgainst:ig.Entity.TYPE.A, // check against player
	collides:ig.Entity.COLLIDES.PASSIVE,


then my player can destroy the crates, but bullets from my enemies will just bounce off the crates.

how to make crates that react to player AND enemy fire? i've tried many combinations, all didn't work :(

1 decade ago by Hareesun

BOTH. :P

Take a read of these two links. Should help. :)

checkagainst
type

1 decade ago by fugufish

lol stupid me :p

only change made was to EntityEnemyBullet : checkedAgainst BOTH
Page 1 of 1
« first « previous next › last »