Hello all. I would like to know some things about the update method.
1.) Does an Update Method occur every second or every frame? I believe it is every frame, but I just want to be sure.
2.) If I call update within update, does it affect the speed at which the code runs? I mean, look at this code:
Assume that @a was defined earlier as 0. update is called so that operations won't run unless @a > 10. Does this work without taking an extra frame or second? I guess this is silly to ask, but I was just curious.
Peace!
1.) Does an Update Method occur every second or every frame? I believe it is every frame, but I just want to be sure.
2.) If I call update within update, does it affect the speed at which the code runs? I mean, look at this code:
Code:
def initialize
@a = 5
end
def update
if @bool == true
@a = 20
@bool = false
end
if @a <= 10
@bool = true
update
end
operations
end
Assume that @a was defined earlier as 0. update is called so that operations won't run unless @a > 10. Does this work without taking an extra frame or second? I guess this is silly to ask, but I was just curious.
Peace!