Thank you that was helpful. [import]uid: 230927 topic_id: 36217 reply_id: 143857[/import]
After getting started if you have any questions feel free to ask. Let me show you how simple healing is and also lifesteal:
function healOnClick( event )
if event.phase == "ended" then
heroHp = HeroHp + 20
end
end
healSpell:addEventListener( "touch", healOnClick )
function healOverTime()
heroHp = heroHp + 5
end
HoTTimer = timer.performWithDelay( 1000, healOverTime, 0 )
lifeSteal = 0.2
-- aka 20%
function doDamage()
heroDmg = totalDmg - enemyArmor
enemyHp = enemyHp - heroDmg
heroHp = heroDmg \* lifeSteal
end
Obviously your code will be more complicated than this, but it’s really easy. I didn’t add the casting heal because I’m lazy to write it. But all you have to do is create a rectangle and a timer that changes the xScale of the rectangle and another timer that casts the heal after 2 seconds and hides the bar after. Good luck
[import]uid: 77199 topic_id: 36217 reply_id: 143861[/import]
Wow didn’t expect all that help. Tyvm for taking the time [import]uid: 230927 topic_id: 36217 reply_id: 143863[/import]
Yes, that is possible. You need a very detailed plan of how your game is going to work. [I was wrong about the rest of my post. Fortunately…] [import]uid: 8271 topic_id: 36217 reply_id: 143850[/import]
My first Corona published game was a top down space shooter (space invaders/asteroids type game).
In the game, your ship takes damage when hit, but over time your shields regenerate , you can pick up power ups that restore your shields to max and every couple of levels your max shields would go up.
I found as a new Corona/Lua programmer (though I had over 30 years of programming experience) these concepts very easy to do with Lua. In face I had done a blog post on the subject of health bars:
http://omnigeek.robmiracle.com/2011/05/30/implementing-a-health-status-bar-in-corona-sdk/
It’s a bit dated, we don’t have the movieclip file any more, but it could be implemented with sprite sheets quite easily.
How complex depends on the rest of your game, but the idea of having a object with a health value that you add to or subtract from is pretty straight forward and showing some text or graphics representing the current health status is pretty straight forward too.
[import]uid: 199310 topic_id: 36217 reply_id: 143914[/import]