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 Nico

        update: function() {
            this.moveToFront();
            var bullets = ig.game.bullets;
            if(bullets > 0) {
                ig.game.statText.draw(bullets, this.pos.x, this.pos.y);
                console.log(bullets);
            }
            this.parent();

So I'm trying to build an inventory system from scratch this morning and the first order of business will be displaying the count of your items in text form.

The above code does everything I want it too except draw the text. I've tried a ton of different ways but none of them have worked so far.

If anyone can shed light on what I would imagine is a pretty simple problem I'd really appreciate it.

1 decade ago by stahlmanDesign

You must put the draw portion of your code in the draw method (not the update method), after this.parent();

draw: function() {

this.parent();

var bullets = ig.game.bullets;
            if(bullets > 0) {
                ig.game.statText.draw(bullets, this.pos.x, this.pos.y);
                console.log(bullets);
            }
}

1 decade ago by Nico

Thanks a ton Stahlman. I feel like an idiot...like I knew I would. It's a learning process!

Much appreciated. Works now :)

-Nico

1 decade ago by paulh

i just realised the other day you can use ig.log rather than console.log, a little quicker to type in :-)
Page 1 of 1
« first « previous next › last »