Thank you for your response dop2000
Yes my Construction_Timer variable is an instance variable for the Construction_Site object which is only going to be used during a construction and is set to instances of that object.
Basically when a building is being constructed, I flatten the height of the building to 0 and then every 0.1 seconds, I want the building to increase in size by 1% of the total height of the building until it reaches its total max height (so it looks like it's growing from the ground). But this needs to happen over a specified construction time, so if I make the construction timer 10 seconds, then it will be 1% of the buildings total height every 0.1 seconds but if the building's total construction timer is 30 seconds, then obviously the 1% will change over that period of time, because some buildings are expected to take longer than others to build depending on the type of building I have for my game, then I need the right formula to get this right.
Let me provide a more specific example of what I'm experiencing:
Let's put the construction timer at a total of 10 seconds, so it will take 10 seconds for my building to complete. The total height of the building is 128 pixels. The construction_timer variable reduces every 0.1 seconds, so we have to consider changing the height of the building every 0.1 seconds.
My old code was this.
The building grows and finishes exactly as the construction_timer finishes.
However, if I do this (where I want to reduce hard-coding and magic numbers):
The building finishes growing at the construction_timer value of 3.7, so the building finishes growing 3.7 seconds earlier than it should.
I will try your suggestion of using the timer behaviour but please tell me what's wrong with my formula in those event blocks, because I will be using the same sort of idea with the timer behaviour.
Edit: I tried using the timer but it does not allow me to perform actions every 0.1 seconds. I do not believe I can achieve what I want to achieve with this behaviour, so I will need to do it the way I have been, but I need to work out what I am doing wrong here.