» Edit Game Info

2 months ago by DominicZelek

Hey guys, I decided to finish a game I started with the impact game engine a few years ago, but I'm having a bit of trouble with the ig.input.state

I followed the tutorial in the book "HTML 5 Game Development" by Jesse Freeman for the most part.

In the tutorial, weapons are created using the ig.input.pressed method, but I would rather use ig.input.state

but when I use input.state the bullets come out one after another incredibly fast. I want to slow it down, but I don't think I really understand how to use timers in impact.

You can play my game in its current state by visiting:

Any help would be greatly appreciated!! Thanks!

2 months ago by Joncom

Yeah, if you use ig.input.state('ATTACK') in your update function, then it will execute roughly 60 times per second (and spawn as many bullets).

Maybe you want to spawn 4 bullets per second?

EntityPlayer = ig.Entity.extend({
    init: function(x, y, settings) {
        this.parent(x, y, settings);
        this.fireTimer = new ig.Timer(1/4);
    update: function() {
        if(ig.input.state('ATTACK') && >= 0) {
  , this.pos.x, this.pos.y);
Page 1 of 1
« first « previous next › last »

Post Reply

Please login or register to reply.