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 dclowd9901

I created a KVO (key-value observance) class for Impact that has robust DOM integration as well. I've found it amazingly helpful in putting together a debug panel I'm working on. Hope you guys can use it!

https://github.com/dclowd9901/impactKVO

1 decade ago by Joncom

This is cool. However, if I wanted to monitor ig.game.player.pos.x for changes, how could I do that? Your readme example does not make that very clear. It seems to say that you can only monitor properties of KVO instances... Is this correct?

1 decade ago by dclowd9901

I got a little ahead of myself in my Readme. At this moment, I'm pretty sure you can't actually monitor Entity data, as this class is branched off of the ig.Class class, and entities are branched off the ig.Entity class. In actuality, monitoring something like `player.pos.x` is probably not a good idea anyway, as that value is changing on each tick, and this class would have to do tree lookups and stack call execution for each mutation, and those values mutate pretty much every tick. I'm working on a way to integrate them, though.

For the time being, if you were so inclined, you could create a data class (a 'model' if you will) inside the Entity structure for all of the stateful entity data you wish to act on, with key data points that don't mutate every tick (isRunning, isShooting), then trigger listeners with those flags using Entity data inside the Entity class (if player.vel.x > 0, player.data.set('isRunning', true, player.vel ) ), which would work basically the same for all intents and purposes. (In that example, isRunning is being set to `true`, and passing the player velocity data along with the trigger.)

1 decade ago by drhayes

Have you seen dat GUI?

1 decade ago by dclowd9901

Quote from drhayes
Have you seen dat GUI?


That's pretty awesome. I wasn't planning on going that far with this module, and that one uses CommonJS AMD vs. the somewhat more proprietary Impact.js module definition. The UI aspects of my plugin are intended to be as lightweight as possible, and really only meant to tie backend data to frontend representation (and trigger changes), not necessarily impose anything on the frontend (dat.gui seems to do things like light validation, etc). I suspect most games don't usually need DOM UI support in canvas -- that was more a lil sumpin sumpin for me ;) .

1 decade ago by Joncom

Quote from drhayes
Have you seen dat GUI?
Very cool. Useful for easily playing around with values!
Page 1 of 1
« first « previous next › last »