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 gxxaxx

I have a level with many little slime pits.

The thought of inputting target.1 player and target.2 slimehurt for 100 of these pits is daunting.

I was thinking of extending the trigger entity and prefill the target.1 and 2 in the slimetrigger entity.

Does this make sense? And what would the syntax be in the code?

I took a few guesses but they didn't yield any functioning results.

target: ("player", "slimehurt"),

Regards,
Claude

p.s. I suppose I should worry about whether 100 triggers in the map will have a significant performance hit.

1 decade ago by dominic

Why don&039;t you just check against an #ig.Entity.TYPE? Or check against all entities - or is there something in your game that can survive in slime pits? See the trigger and hurt entities from the Biolab Entity Pack - it checks against ig.Entity.TYPE.A by default. If you need these a lot, you could also combine the two entities into a single one that kills all other entities that touch it.

There will be some performance hit by having 100 triggers in your level, but I don't think it'll be that big. Test it.

1 decade ago by gxxaxx

Thanks for the response.

Inspired by your suggestion (and the fact that I do have creatures that fly) I used the following

	check: function( other ) {
		if( this.canFire && this.waitTimer.delta() >= 0 ) {
			if (other.fly === true) {
				return;
			}
			if( typeof(other.receiveDamage) == 'function' ) {
				other.receiveDamage(this.damage, this);
			}
			if( this.wait == -1 ) {
				this.canFire = false;
			}
			else {
				this.waitTimer.set( this.wait );
			}
		}
	},

This seems to work fine for the damage part.

My problem was a minor fixation on using triggeredBy on a hurt entity.
Page 1 of 1
« first « previous next › last »