Problem Trying to make a thrust indicator

johnnymanly

Donator
Donator
Joined
Mar 17, 2008
Messages
179
Reaction score
116
Points
43
Location
Southwest Pennsylginia
Website
sites.google.com
I'm trying to make a thrust level indicator in a vc using a sketchpad rectangle.
this toggles it between 0 and 1:
Code:
for i = 0, 1 do
    if vi:get_thrusterlevel(thmain) == i then
      pSkp:rectangle(0, i*1024, 1024, 0)
    end
  end
But how do I make it proportional?
Screenshot_20250225_194119.png
 
How about you just first remove the surrounding if statement? And then, you need to calculate the proper height of the rectangle

If the parameters are like C++, it should go like:

Code:
pSkp:rectangle(<LEFT>, 1024 - <THRUST>*1024, <WIDTH>, <THRUST>*1024)

With <LEFT>, <THRUST> and <WIDTH> being the fitting constants and variables for your case.

Of course assuming, you want to paint on the full texture and this texture is 1024 pixels high.

The smarter solution would be just manipulating the vertex coordinates of a meshgroup for the indicator bar... more math, but much faster rendering performance.

But of course, the Sketchpad solution of more straight forward and easier to understand.
 
Back
Top