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 blast

Loving Impact. Got a quick question for .pressed() though. I've created a few buttons (entities in welt) that I would like to push with the mouse in my game. The problem is, .pressed() seems to only work for the first entity with that assigned action unless I'm missing something?

If I set my mouse left click to an action called "click" and then I give an entity a check for "click" in the update, then put multiple entities on my map... Only the first entity created will respond. I did notice that using .state() does seem to work for both entities, would using state() be the correct way, and then write my own code to prevent 'autofire'?

nefD, I noticed you did something like this in your sweet pipewalk game you just posted, but I'm guessing you did some DOM tricky-ness for that? Got some hints? :)

Thanks for any suggestions!

1 decade ago by nefD

@Blast

Thanks for the kind words! In Pipewalk, I was able to cheat a bit. I actually have a single 'brain' entity checking for a pressed event. When it is detected, I grab the current X and Y position of the mouse, via ig.input.mouse.x and ig.input.mouse.y, and use them to determine where on the grid the user clicked, and forward the event on to the entity at that location.

Hope this helps!
Page 1 of 1
« first « previous next › last »