phoboslab / Impact

HTML5 Game Engine
MIT License
1.99k stars 204 forks source link

ig.Entity.settings declared but unused (never set or accessed) #65

Closed Joncom closed 3 years ago

Joncom commented 5 years ago

https://github.com/phoboslab/Impact/blob/70f34c803acc39ff1ec2b706a5be512dc4275e0d/lib/impact/entity.js#L10-L12

Therefore, line 12 could probably be removed?

gamecubate commented 3 years ago

I was passing through and saw this. This property is in fact quite useful (I've used it many times). Should not be dropped.

Joncom commented 3 years ago

As far as I could tell, the value was always undefined. How were you using it?

Joncom commented 3 years ago

I mean, not undefined, but an empty object...

gamecubate commented 3 years ago

I think the Entity class docs explain it best :

Typically, you should create your entities through the ig.Game's spawnEntity() method, which creates the entity and adds it to the game world. The settings object overwrites the properties for this one particular entity.

var settings = {health: 100, vel: {x: 200, y: 100}};
var myEnt = new EntityMyEntityClass( 0, 0, settings );

Weltmeister makes use of the settings object, to store additional settings for each entity.