Login
Community
DARK THEME

Help Needed Again

How to check if a variable gets subtracted?

What do you mean? Do you mean how to check if a variable changes (in any way) at any point? If you do then you can just use a separate variable to keep track of it and then check if it changes:

init=function()
  var=0
  trackvar=var
end

update=function()
  if not trackvar==var then
    // Variable has changed - if you want to make it to check if the variable is less you would do 'if trackvar>var then'
  end
  trackvar=var //Reset for next cycle
end

Perhaps not the best solution but it works ^^.

I'm using an object with HP so I will have to check if my object gets damaged to check if the damage cooldown is finished.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community