What I’m working on is a way to add projectiles to the user as they reach certain scores.
I’m using the Implementing a Health Status Bar in Corona SDK found here
http://omnigeek.robmiracle.com/2011/05/30/implementing-a-health-status-bar-in-corona-sdk/
So I have it all set up and it works fine, now what I did is they start off with 2 maxLives and as they reach scores a gamelife and the maxlives increase, but this way I get an error- corona sdk attempt to concatenate upvalue on orbshot **the line referenced is: local projectile = display.newImage( “”…orbshot…"" )
which I would think the orbdensity on the line above it would cause this error first.
function newProjectile()
print("maxLives:"..maxLives)
if maxLives == 2 then
local orbshot = "imagesGame/cinderblock.png"
local orbdensity = 1
end
if maxLives == 3 then
local orbshot ="imagesGame/tire.png"
local orbdensity = 1.5
end
if maxLives == 4 then
local orbshot ="imagesGame/tirelooseicon.png"
local orbdensity = 1
end
if maxLives == 5 then
local orbshot ="imagesGame/tirelooseicon.png"
local orbdensity = 1
end
local projectileDensity = orbdensity
local projectile = display.newImage( ""..orbshot.."" )
game:insert( projectile )
physics.addBody( projectile, { density=projectileDensity, friction=0.7, bounce=0.2} )
orb=projectile
orb.myName = "orb";
orb.bodyType = "kinematic";
orb.x = 85;
orb.y = \_H ;
orb.linearDamping = 0.3 ;
orb.angularDamping = 0.8 ;
orb.isBullet = true
transition.to(orb, {time=600, y=\_H - 70, transition = easingx.easeOutElastic});
return orb;
end
If I remove these lines it works fine
if maxLives == 2 then
end
Except when I add to the maxlifes, it stays here and doesn’t go to the if maxlifes == 3 lines and so on.
Any ideas on why this is happening?
Dan [import]uid: 78446 topic_id: 20156 reply_id: 320156[/import]
[import]uid: 52491 topic_id: 20156 reply_id: 78889[/import]