transition.to within timer.performdelay

FuelGaugeArrow:rotate( 75 ) local FuelDecreaseAngle = 150 / FuelLevelMax local function BurnFuel(event) --transition.to( FuelGaugeArrow, { rotation = FuelGaugeArrow.rotation - FuelDecreaseAngle } ) FuelGaugeArrow.rotation = FuelGaugeArrow.rotation - FuelDecreaseAngle FuelLevel = FuelLevel -1 if FuelLevel \<=0 then OutOfFuel() end end local FuelBurn = timer.performWithDelay( 1000, BurnFuel , 0)

The FuelGaugeArrow value is updated by another function (when the rocket picks up a fuel barrel, it increases the value).

This works fine in the code above, but when I use the commented-out code, i.e. when I try to use transition to move the arrow, it only works when there is no transition going on at that precise moment. The updated value is not picked up by the BurnFuel function when transition is in progress.

I’m sure there’s a better way to do this, so please enlighten me.

I think you should define a transition time, maybe there’s one by default, but i’d rather set one.

  1. –transition.to( FuelGaugeArrow, { time=500, rotation = FuelGaugeArrow.rotation - FuelDecreaseAngle } )

Otherwise I can’t see anything wrong on it.

I tried it before with a transition time, it doesn’t make a difference, the FuelGaugeArrow value is not updated when the transition is, … well… transitioning.

Here is the code I use to send the value in the other function:

local function ScrollExtras(event) if FuelGaugeArrow.rotation + FuelIncreaseAngle \<= 75 then FuelGaugeArrow.rotation = FuelGaugeArrow.rotation + FuelIncreaseAngle else FuelGaugeArrow.rotation = 75 end end Runtime:addEventListener( "enterFrame", ScrollExtras )

I think you should define a transition time, maybe there’s one by default, but i’d rather set one.

  1. –transition.to( FuelGaugeArrow, { time=500, rotation = FuelGaugeArrow.rotation - FuelDecreaseAngle } )

Otherwise I can’t see anything wrong on it.

I tried it before with a transition time, it doesn’t make a difference, the FuelGaugeArrow value is not updated when the transition is, … well… transitioning.

Here is the code I use to send the value in the other function:

local function ScrollExtras(event) if FuelGaugeArrow.rotation + FuelIncreaseAngle \<= 75 then FuelGaugeArrow.rotation = FuelGaugeArrow.rotation + FuelIncreaseAngle else FuelGaugeArrow.rotation = 75 end end Runtime:addEventListener( "enterFrame", ScrollExtras )