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

6 years ago by Dhoombaby

Hello,
I need help for developing logic in my game called jumpnrun.
In that if my player collide with enemy then on top left corner one heart should blast and its particles should fall down. The player will not get killed only its health will get reduced. Pls reply with good and easy logic as early as possible.

6 years ago by stillen

This is covered in great detail in this book. It is also featured on the homepage of the site.


http://www.amazon.com/gp/product/1449315178

6 years ago by Dhoombaby

Thanks for reply...but can u give us some code for that??

6 years ago by Dhoombaby

Hello Stillen i am searching for that code in above mentioned book, but i coundn't find the code...so can u please give us the page number which we should refer for our query. Thanks once again.

6 years ago by lTyl

In your player.js:

receiveDamage:function (amount, from) {
                this.parent(amount, from);
                // Spawn the particle emitter where you draw your life
            }

In your enemy check function, check if colliding with a player and then call other.receiveDamage(damage amount, this);

Your life bar should automatically change, since it's being drawn every frame. It should look something like this: In main.js draw:
                    for(var i=0; i < this.player.health; i++)
                        this.lifeSprite.draw(this.lifeSprite.width * i, ig.system.height-40);

In the book, the "Killing Entities" sub-section covers doing damage to entities. For add a HUD to your game, check the "Adding In-game HUD" section in Chapter 7

6 years ago by Dhoombaby

Thanks lTyl for your reply. Its now working. Thanks once again....

6 years ago by Dhoombaby

In My new game dhoom baby i have loaded :
new ig.Sound( 'media/sounds/dhoom_race.mp3' ) but the game is not loading its giving error like :-
uncaught exception: Failed to load resource: media/sounds/dhoom_race.mp3

Can anyone explain me what would be the problem..i have that dhoom_race.mp3 file in my media/sounds folder. Reply as early as possible. Thank You.

6 years ago by stillen

It's probably because not all browsers can play mp3 files, you would need to supply the correct sound file type.

http://impactjs.com/documentation/class-reference/sound

6 years ago by Dhoombaby

Hello,
In my game i want to calculate time elapsed per level on top right side of game screen. But i want the time format in secs::milliseconds. Can anyone pls tell me in impactjs how do i implement it?
Page 1 of 1
« first « previous next › last »