Oxygen Basic
Programming => Example Code => Topic started by: Aaron on March 20, 2014, 02:17:17 PM
-
Hi,
Stone age programming.
'--Rotating PLANETS
'--Davey W Taylor
'--audio.squad@mailbox.swipnet.se
'-- ported to Lua by Cybermonkey
'-- ported to OxygenBasic by P. Wirbelauer
'--- setup ---
include "ss.inc"
OpenWindow 640,480,1
int moonspin = 16
int earthspin = 4
int yflip
'cls 0,0,0
a = 1
yflip = earthspin + yflip
single d, di, r, ri, s, x, y, d2, r2, s2, t, x2, y2
while Key(27)=0
cls 0,0,0
d = (d + earthspin) % 360
r = d * (pi / 180)
di = (di + yflip) % 360
ri = di * (pi / 180)
s = 10 + (cos(r) * 10)
x = 320 + (200 * sin(r))
y = 175 + (50 * sin(ri))
d2 = (d2 + moonspin) % 360
r2 = d2 * (pi / 180)
s2 = 4 + (cos(r2) * 2) + (cos(r) * 2)
t = 50 + (25 * cos(r))
x2 = x + (t * sin(r2))
y2 = y + (4 * cos(r2))
iF (10 *cos(r)) >= 0 then
color 255,255,0,255
fillcircle 320, 175, 100
End iF
iF (10 * cos(r2)) <= 0 then
color 100,100,100,255
fillcircle x2, y2, s2
End iF
color 0,0,255,255
fillcircle x, y, s
iF (10 * cos(r2)) > 0 then
Color 100,100,100,255
fillcircle x2, y2, s2
End iF
iF (10 * cos(r)) < 0 then
color 255,255,0,255
fillcircle (320, 175, 100)
End iF
Sync
Wait 10
wend
CloseWindow
-
Stone age programming.
Absolutely, Peter.
I think the forum should be re-registered under the name of retrobasiclikeprogramming.org.
-
retrobasiclikeprogramming.org.
Mike,
Absolutely, ;D
-
Hello,
once again: Alpha test.
include "ss.inc"
openwindow 320,240,1
byte r,g,b,a
int pixel
clsA 248,248,255,255
pixel = GetPixel 200,200
r = GetR(pixel)
g = GetG(pixel)
b = GetB(pixel)
a = GetA(pixel)
color 255-r,255-g,255-b,255
drawstring 0, 0,"RED: " + r + " GREEN: " + g " BLUE: " + b + " ALPHA: " + a
drawstring 0,12,"PIXEL = " + pixel
drawstring 0,24,"RGBA = " + RGBA(r,g,b,a)
blend = RGBA(255,255,255,40)
color 0,0,0,255
Drawstring 0,48,"BLEND " + blend
r = GetR(blend)
g = GetG(blend)
b = GetB(blend)
a = GetA(blend)
color 255-r,255-g,255-b,a
fillrect 100,100,80,20
color 0,0,0,255
Drawstring 0,60,"ALPHA " + a
waitkey
closewindow
-
Hello,
Line storm with wind.
include "ss.inc"
openwindow 800,600,1
type rain
single x,y
sys fs, angle
end type
rain drop[1000]
h = getheight
w = getwidth
sys drops
while key(27)=0
cls 0,0,0
if drops =0
for i=1, 1000
drop[i].x = rnd(0,w)
drop[i].y = 0
drop[i].fs = rnd(14,16)
drop[i].angle = rnd(100,110)
next
drops=1
end if
for i=1, 1000
drop[i].x = drop[i].x + cos(drop[i].angle)*drop[i].fs
drop[i].y = drop[i].y + sin(drop[i].angle)*drop[i].fs
color 255,255,255,rnd(64,255)
aaline drop[i].x, drop[i].y, drop[i].x+cos(drop[i].angle)*drop[i].fs, drop[i].y+sin(drop[i].angle)*drop[i].fs
if drop[i].y > rnd(400,600)
drop[i].x = rnd(0,w)
drop[i].y = -10
end if
if drop[i].x < 0 then drop[i].x = w
if drop[i].x > w then drop[i].x = 0
next
color 255,128,128,255
DrawString 300,550,"LINE STORM WITH WIND"
sync
wend
closewindow