good effect lost energy

Hello! In my game have “energy”, and energy cost by move character (step by step game).

And i need “effected” cost energy by moving.

I trying this:

[lua] trans1 = transition.to(
char,
{time=2500, x=newX, y=newY , onStart=deleteEnergy, onComplete=moveToPoint}
)[/lua]

and this:

[lua]function deleteEnergyPoint:timer( event )
leftEnergy = leftEnergy - 1 – how many need cost energy
energy = energy - 1 – -1 from energy “in” character

field1.text = "Energy: " … math.round(energy)
print( "Deleting… "… leftEnergy )

if leftEnergy == 0 then
timer.cancel( event.source ) – after 3rd invocation, cancel timer
event.source = nil
end
end

local deleteEnergy = function( obj )
timer.performWithDelay( 2500/math.round(leftEnergy ), deleteEnergyPoint, 0 )
end[/lua]

its work, him cost energy, but ugly, no effect.

How can create “cost energy”, now i show energy in Text field, with effects?
Wait answer, thanks!

[import]uid: 211767 topic_id: 35457 reply_id: 335457[/import]

I’m really sorry but I’ve read your question a few times and don’t quite understand what you are trying to do.

As far as I understand you start the game with X amount of energy, and each time you move the total amount of energy decreases.

After that…you’ve lost me. When you say “ugly, no effect.” do you mean the transition.to effect is not working? Or that you do not like how it is working?

I’m also not sure what you mean by “How can create “cost energy”, now i show energy in Text field, with effects?”

If you can try to explain the problem in a bit more detail then hopefully I can help.
[import]uid: 84115 topic_id: 35457 reply_id: 141234[/import]

I’m really sorry but I’ve read your question a few times and don’t quite understand what you are trying to do.

As far as I understand you start the game with X amount of energy, and each time you move the total amount of energy decreases.

After that…you’ve lost me. When you say “ugly, no effect.” do you mean the transition.to effect is not working? Or that you do not like how it is working?

I’m also not sure what you mean by “How can create “cost energy”, now i show energy in Text field, with effects?”

If you can try to explain the problem in a bit more detail then hopefully I can help.
[import]uid: 84115 topic_id: 35457 reply_id: 141234[/import]