Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
if x>10 and y<5 then
screen.setColor(255,0,0) --Sets color to red if x>10 and y<5. Omitting the last t value defaults it to 255, full opaque.
elseif x<10 then
screen.setColor(0,255,0) --Sets to green if x<10 and the above 'if' statement was false.
else
screen.setColor(255,255,255) --Sets to white if none of the above 'if' statements were true.
end
screen.drawCircle(x,y,3) --draws a circle centered at x,y of radius 3. The color will depend on the values of x and y, as dictated in the above 'if' statements.
You can also do interesting things like:
screen.setColor(x*10, y-20, x), where the r,g,b values use x and y as variables.
Try this fun example. Set up a throttle lever and a monitor in your cockpit. Input the throttle lever value into LUA.
screen.setColor(255*(1-throttle),255*throttle,0)
screen.drawRectF(1,1,10,10)
This will draw a square that changes color based on the throttle value. At zero throttle, the square is red; at 0.5, it is yellow (actually it is more brown - you can fix this, but that is not the point of the example); at 1, it is green. This clever use of variables can allow you to do really cool visual representations of the status of your creation and make your cockpit really shine.
Hope this helps!
I wasnt throwing errors but I wasnt getting results either.