• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Simple maths problem

U

Ukaygee

Guest
Hi, so I'm drawing a sprite with draw_sprite_ext(), and I need to manipulate the xscale.
The xscale has to be between 0-1, but I'm having trouble getting my head around the maths xD

So, the score variable controls what the xscale is, for example, if score = 10, divide that by 100, and set the xscale to that. That's pretty simple.

However, I want "targetscore" to be equal to an xscale of "1", but I'm struggling a bit xD.

I don't know if any of this makes sense, but here's a visual xD:
upload_2018-4-29_15-56-42.png
So, I would want the green bar to be at the very LEFT of the rectangle when score is the same as targetscore, and when score is 0, have it be at the very RIGHT.

Anyone have any ideas on the maths? xD
Thanks
 
Top