Here's my entry so far. It's by far some of my sloppiest code in a long time! I had no clue what direction I was going so I'm sure I have code mixed in there that isn't even being used.
Rem fubarpk techDemo
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Demo" )
SetWindowSize(1280,720, 0 )
// set display properties
SetVirtualResolution(1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 60, 0 ) //
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
Type MyText
id as integer
pop as integer
drop as float
EndType
t as MyText[23]
for i = 0 to t.length-1
t[i].id = createText("Super awesome ultra 360 hyper Go platinum demo... Gold Edition!")
setTextSize(t[i].id, 0)
SetTextAlignment(t[i].id, 1)
next i
f = loadFont("Courier New")
a as MyText[73]
gosub amiga
for i = 0 to a.length-1
setTextFont(a[i].id, f)
setTextSize(a[i].id, 16)
SetTextAlignment(a[i].id, 1)
next i
timestamp = 0
timestamp1 = 0
phase = 1
amount = 800
colors as integer[108]
colors[0] = makeColor(random(0,255), random(0,255), random(0,255))
colors[35] = makeColor(random(0,255), random(0,255), random(0,255))
colors[71] = makeColor(random(0,255), random(0,255), random(0,255))
colors[107] = makeColor(random(0,255), random(0,255), random(0,255))
for i = 1 to 34
t# = i/36.0
r = getColorRed(colors[0]) + (getColorRed(colors[35]) - getColorRed(colors[0]) ) * t#
g = getColorGreen(colors[0]) + (getColorGreen(colors[35]) - getColorGreen(colors[0])) * t#
b = getColorBlue(colors[0]) + (getColorBlue(colors[35]) - getColorBlue(colors[0]) ) * t#
colors[i] = makeColor(r,g,b)
next i
for i = 36 to 70
t# = (i-36)/36.0
r = getColorRed(colors[35]) + (getColorRed(colors[71]) - getColorRed(colors[35]) ) * t#
g = getColorGreen(colors[35]) + (getColorGreen(colors[71]) - getColorGreen(colors[35])) * t#
b = getColorBlue(colors[35]) + (getColorBlue(colors[71]) - getColorBlue(colors[35]) ) * t#
colors[i] = makeColor(r,g,b)
next i
for i = 72 to 106
t# = (i-72)/36.0
r = getColorRed(colors[71]) + (getColorRed(colors[107]) - getColorRed(colors[71]) ) * t#
g = getColorGreen(colors[71]) + (getColorGreen(colors[107]) - getColorGreen(colors[71])) * t#
b = getColorBlue(colors[71]) + (getColorBlue(colors[107]) - getColorBlue(colors[71]) ) * t#
colors[i] = makeColor(r,g,b)
next i
Type Star
x as float
y as integer
EndType
count = 0
stars as Star[200]
for i = 1 to 200
stars[i].x = random(0,1480)
stars[i].y = random(0, 360)
next i
RED = MakeColor(255,0,0)
WHITE = MakeColor(255,255,255)
ox1#=0
ox2#=0
drop = 0
gy = 720
shadow = createSprite(createShadow())
ball = createSprite(createBall())
setSpriteDepth(ball, 2)
setSpriteSize(shadow, 130,75)
setSpriteColorAlpha(shadow, 92)
setSpriteVisible(ball, 0)
angle = 0
Type Monkey
x as integer
y as integer
rot as integer
EndType
Type MonkeyArray
monkey as Monkey[20]
wave as float
y as integer
EndType
spacemonkeys as MonkeyArray[5]
for i = 0 to spacemonkeys.length
spacemonkeys[i].wave = random(0,360)
spacemonkeys[i].monkey[0].rot = random(0,360)
spacemonkeys[i].monkey[0].x = random(0,1280)
spacemonkeys[i].y = random(50,320)
next i
Type Ball
spr as integer
x as integer
y as integer
z as integer
shadow as integer
EndType
balls as Ball[20]
balls[1].spr = createSprite(createOrb(100,WHITE,makeColor(110,110,110)))
setSpriteColor(balls[1].spr, random(40,255),random(40,255),random(40,255),255)
balls[1].x = 640 + cos(18)*200
balls[1].y = 360 + sin(18)*100
setSpriteSize(balls[1].spr, 4, 4)
balls[1].shadow = createSprite(createOrb(100,0xFF000000,0xFF000000))
setSpriteDepth(balls[1].shadow, 40)
setSpriteColorAlpha(balls[1].shadow, 30)
setSpriteVisible(balls[1].spr, 0)
for i = 2 to 20
balls[i].spr = cloneSprite(balls[1].spr)
setSpriteColor(balls[i].spr, random(40,255),random(40,255),random(40,255),255)
balls[i].x = 640 + cos(i*18)*200
balls[i].y = 360 + sin(i*18)*100
setSpriteSize(balls[i].spr, i*4, i*4)
balls[i].shadow = cloneSprite(balls[1].shadow)
next i
setSpriteColor(balls[1].spr, 255,255,255,255)
phase = 1
bx = -100
ba=0
DO
render()
//sinwave
if phase = 1 then gosub TextStuff
if phase = 2
ms = getMilliseconds()
if timestamp+100 <= ms
a[drop].drop = 0.1
inc drop
timestamp = ms
if drop > 73
phase = 3
setSpriteVisible(ball, 1)
for i = 1 to 20
setSpriteVisible(balls[i].spr, 1)
next i
endif
endif
endif
gosub doColors
doStars(stars)
if phase = 3
gosub Ground
gosub flyingSpacemonkeys
gosub MyBalls
// rolling ball
positionBall(ball, shadow, bx, 450)
inc bx, 1
if bx > 1350 then bx = -100
endif
/*
if id < t.length-1
ms = GetMilliseconds()
if timestamp+60 <= ms
timestamp = ms
inc id
pop(t, id)
endif
endif
*/
dropText(a)
animatePop(t)
Render2DFront()
sync()
LOOP
MyBalls:
inc ba
if ba > 359 then ba = 0
for i = 1 to 20
ag = i*18+ba
if ag > 360 then ag = ag - 360
ta = wrapValue(ag+90, 0, 359)
d# = (180-abs(ta-180)) / 180.0
size = 50*d# + 30
depth = 30 - 20*d#
setSpriteSize(balls[i].spr, size, size)
setSpriteDepth(balls[i].spr, depth)
balls[i].x = 640 + cos(ag)*200
balls[i].y = 360 + sin(ag)*50
setSpritePosition(balls[i].spr, balls[i].x, balls[i].y)
setSpriteSize(balls[i].shadow, size, size/2)
setSpritePosition(balls[i].shadow, balls[i].x, balls[i].y+50)
next i
RETURN
function wrapValue(v#, min, max)
v# = mod((mod((v# - min), (max-min)) + (max-min)), (max-min)) + min
endfunction v#
function positionBall(b, s, x, y)
setSpritePosition(s, x-25, y+20)
setSpritePosition(b, x, y)
setSpriteAngle(b, getSpriteAngle(b)+3)
endfunction
function drawSquare(x, y, width, rot, c)
w = width/2
s# = sin(rot)
c# = cos(rot)
x1 = x + (-w * c# - -w*s#)
y1 = y + (-w * s# + -w*c#)
x2 = x + (w * c# - -w*s#)
y2 = y + (w * s# + -w*c#)
x3 = x + (-w * c# - w*s#)
y3 = y + (-w * s# + w*c#)
x4 = x + (w * c# - w*s#)
y4 = y + (w * s# + w*c#)
drawLine(x1, y1, x2, y2, c,c)
drawLine(x3, y3, x4, y4, c,c)
drawLine(x1, y1, x3, y3, c,c)
drawLine(x2, y2, x4, y4, c,c)
endfunction
function createOrb(radius, c1, c2)
render()
drawEllipse(radius, radius, radius, radius, c1, c2, 1)
swap()
img = getImage(0,0,radius*2,radius*2)
sync()
endfunction img
function createBall()
Render()
DrawEllipse(50,50,25,25,MakeColor(255,255,255),MakeColor(100,100,100),1)
drawEllipse(60,60,5,5,MakeColor(100,100,100),MakeColor(255,255,255), 1)
Swap()
img = getimage(0,0,100,100)
sync()
endfunction img
function createShadow()
Render()
DrawEllipse(50,50,25,25,MakeColor(0,0,0),MakeColor(0,0,0),1)
Swap()
img = getimage(0,0,100,100)
sync()
endfunction img
TextStuff:
dec amount
ang = ang + 4
for i = 0 to a.length-1
if amount <= 0 then phase = 2
o# = sin(ang+i*10)*amount
setTextPosition(a[i].id, 640+o#, i*10)
next i
RETURN
flyingSpacemonkeys:
// update lead monkey, reinitialize if off-screen
for i = 0 to spacemonkeys.length
spacemonkeys[i].monkey[0].x = spacemonkeys[i].monkey[0].x - 4
spacemonkeys[i].monkey[0].y = spacemonkeys[i].y +cos(spacemonkeys[i].wave)*50
spacemonkeys[i].monkey[0].rot = spacemonkeys[i].monkey[0].rot - 6
spacemonkeys[i].wave = spacemonkeys[i].wave + 3
if spacemonkeys[i].monkey[0].x < -150
spacemonkeys[i].monkey[0].x = 1300
spacemonkeys[i].y = random(50,360)
spacemonkeys[i].wave = random(0,360)
spacemonkeys[i].monkey[0].rot = random(0,360)
endif
next i
ms = GetMilliseconds()
if timestamp1+10 <= ms
for i = 0 to spacemonkeys.length
for j = spacemonkeys[i].monkey.length to 1 step -1
spacemonkeys[i].monkey[j].x = spacemonkeys[i].monkey[j-1].x
spacemonkeys[i].monkey[j].y = spacemonkeys[i].monkey[j-1].y
spacemonkeys[i].monkey[j].rot = spacemonkeys[i].monkey[j-1].rot
next j
next i
timestamp1 = ms
endif
for i = 0 to spacemonkeys.length
for j = spacemonkeys[i].monkey.length to 1 step -1
size = 40-(spacemonkeys[i].monkey.length-j)*2
drawSquare(spacemonkeys[i].monkey[j].x, spacemonkeys[i].monkey[j].y, size, spacemonkeys[i].monkey[j].rot, colors[j])
next j
next i
RETURN
doColors:
// color fading
inc count
for i = 0 to a.length-1
setTextColor(a[i].id, getColorRed(colors[i]), getColorGreen(colors[i]), getColorBlue(colors[i]),255)
next i
for i = 0 to colors.length-2
colors[i] = colors[i+1]
next i
if count = 36
count = 0
colors[73] = colors[72]
colors[108] = makeColor(random(0,255), random(0,255), random(0,255))
for j = 74 to 107
t# = (j-73)/35.0
r = getColorRed(colors[73]) + (getColorRed(colors[108]) - getColorRed(colors[73]) ) * t#
g = getColorGreen(colors[73]) + (getColorGreen(colors[108]) - getColorGreen(colors[73])) * t#
b = getColorBlue(colors[73]) + (getColorBlue(colors[108]) - getColorBlue(colors[73]) ) * t#
colors[j] = makeColor(r,g,b)
next j
endif
RETURN
function dropText(t ref as MyText[])
for i = 0 to t.length-1
if t[i].drop > 0
setTextPosition(t[i].id, 640, getTextY(t[i].id)+t[i].drop)
t[i].drop = t[i].drop + 0.1
endif
next i
endfunction
function animatePop(t ref as MyText[])
for i = 0 to t.length-1
s = getTextSize(t[i].id)
if t[i].pop = 1
if s < 40
setTextSize(t[i].id, s+3)
else
t[i].pop = 2
endif
elseif t[i].pop = 2
if s > 32
setTextSize(t[i].id, s-1)
else
setTextSize(t[i].id, 32)
t[i].pop = 0
endif
endif
next i
endfunction
function pop(t ref as MyText[], r)
if t[r].pop > 0 then exitfunction
t[r].pop = 1
setTextSize(t[r].id, 0)
setTextPosition(t[r].id, 640, r*32)
endfunction
//sinwave
/*
a = a + 4
for i = 0 to t.length-1
o# = sin(a+i*10)*260
setTextPosition(t[i].id, 640+o#, i*32)
next i
*/
function doStars(stars ref as Star[])
for i = 1 to 200
stars[i].x = stars[i].x - 0.25
c = random(100,255)
color = makeColor(c,c,c)
drawBox(stars[i].x,stars[i].y,stars[i].x+1,stars[i].y+1,color,color,color,color,1)
if stars[i].x < 0
stars[i].x = random(1280,1480)
stars[i].y = random(0, 360)
endif
next i
endfunction
Ground:
dec gy, 8
if gy <= 360 then gy = 360
ox1# = ox1# - 0.25
ox2# = ox2# - 2
if ox1# = -16 then ox1# = 0
if ox2# = -128
ox2# = 0
flip = 1-flip
endif
for x = 1 to 100
x1=640 + (x-50)*16
`drawLine(x1+ox1#,gy, 640+(x-50)*128+ox2#,720, RED,RED)
if mod(x,2)=flip
color = RED
else
color = WHITE
endif
for i = 0 to 127
f=i/4
drawLine(x1+ox1#+f,gy, 640+(x-50)*128+ox2#+i,720, color,color)
next i
next x
RETURN
amiga:
a[0].id =createText(" MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM7 ")
a[1].id =createText(" MM????????????????ZMM=====================================MMO????????ZM$ ")
a[2].id =createText(" MM????????????????ZMM==========================MMMMMMMMM==MMO??????????MM ")
a[3].id =createText(" MM????????????????ZMM==========================MMI777IMM==MMO??????????IMMO ")
a[4].id =createText(" MM????????????????ZMM==========================MM+???+MM==MMO????????????ZMZ . ")
a[5].id =createText(" MM????????????????ZMM==========================MM+???+MM==MMO?????????????7MM~.")
a[6].id =createText(" MM????????????????ZMM==========================MM+???+MM==MMO???????????????MM7")
a[7].id =createText(" MM????????????????ZMM==========================MM+???+MM==MMO????????????????MM")
a[8].id =createText(" MM????????????????ZMM==========================MM????+MM==MMO????????????????MM")
a[9].id =createText(" MM????????????????ZMM==========================MMI777IMM==MMO????????????????MM")
a[10].id=createText(" MM????????????????ZMM==========================MMMMMMMMM==MMO????????????????MM")
a[11].id=createText(" MM????????????????ZMM=====================================MMO????????????????MM")
a[12].id=createText(" MM????????????????ZMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO????????????????MM")
a[13].id=createText(" MM????????????????IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII????????????????MM")
a[14].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[15].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[16].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[17].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[18].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[19].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[20].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[21].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[22].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[23].id=createText(" .. MM???????????????????????????????????????????????????????????????????????????MM")
a[24].id=createText(" MM???????????????????????????????????????????????????????????????????????????MM")
a[25].id=createText(" . MMMM??????I+++++M MMMMMM++++++++++++++++++++++++++++++++++++++++++++++++??????MM")
a[26].id=createText(" :MMM MM???????MMMMM M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM??????MM")
a[27].id=createText(" MD. . MM???????MM ,M M+,M MM??????MM")
a[28].id=createText(" ZM= MM???????MMZM= M=,M MM??????MM")
a[29].id=createText(" :MZ . MM???????MMMMM= M=,M MM??????MM")
a[30].id=createText(" IM MM???????MMMM~M= M=,M :I..7I: .III. .I. :I..7III .IIII MM??????MM")
a[31].id=createText(" M MM?????MMMM.. OMMMMMN.,M :?. I?.... ? .?..,?.+????I.I+. ?~ MM??????MM")
a[32].id=createText(" Z7 . MM????8MMO .. ,M .?==I? .:?==: .+==+?.:I==I:.:?=:?~ MM??????MM")
a[33].id=createText(" :M+ MM?INMMO. +8 .I?.. . . . . ..?=. MM??????MM")
a[34].id=createText(" . M. M MMMMMMM ON . . . ... . MM??????MM")
a[35].id=createText(" DM . MM ?MMMMM. . MM . .... . ........ . . . MM??????MM")
a[36].id=createText(" .M, . MMM7 . ?M 7I.II. ?:..I..?7 ~?7 7?. MM??????MM")
a[37].id=createText(" M8 ~OMO . =N.. :?=II ?I :?: .?. ?I ~?=?=?, MM??????MM")
a[38].id=createText(" MM. . .:MM .MM .I..II I? II .:?I?. ~I...?, MM??????MM")
a[39].id=createText(" M M N. . M= . . 7I+..... . .... =I . I, MM??????MM")
a[40].id=createText("M MM. ,M . .... . . . . MM??????MM")
a[41].id=createText("M MM ,M ~MMM+ MMM~=MMM~. ~MMMM7MMMMO~M=$MMMMMMM.7MM~ MM??????MM")
a[42].id=createText("M :. ,M .8MOOO+. 8?.+MM$..NM, :M:.NM= OM~ IMOOO?, MM??????MM")
a[43].id=createText("M ,M .8N M= MMM= MM8..M: M8 IMM=$M IM $.. MM??????MM")
a[44].id=createText("M ,M .8MI M. :MM, M= MM?M:NMM+. IMM~ MM??????MM")
a[45].id=createText("M ,M .8~ MMM7= 7MMM:=OMM8. NMM$ I+ MM??????MM")
a[46].id=createText("M .8O MM??????MM")
a[47].id=createText("M .IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM")
a[48].id=createText("M M=MM. . .MMM+ M ")
a[49].id=createText("M M~ MMMM MMMM .M . . .. ")
a[50].id=createText("M MMMM==+M~ 8MMM M OOOO OOOOO, OO. .OZOO: ")
a[51].id=createText("M MO ..N= +MMMZ M, =MM. +MZ OMM :MMZZMM+ ")
a[52].id=createText("M MO. ..MMMMM.. .NM. =MM .MMO.. MM ..MM ")
a[53].id=createText("M M: MMM. ZMMMM MMM . +M =MM MM MM .. MMM: ")
a[54].id=createText("M. M~ MMMMMMMMMM . M M. =MMM? MM .$MM MMM ")
a[55].id=createText("MM M= ,MMM . .+ MZ .=MM .MMMMM.DM MMMM: .")
a[56].id=createText(" M M= :8MZ .8M MM ")
a[57].id=createText(" M M= M MMMM MMM ")
a[58].id=createText(" M . M= MMMM. + ")
a[59].id=createText(" M ,M . M ")
a[60].id=createText(" M 8888888N, MM ")
a[61].id=createText(" M MM$$$$$ . :M$ ")
a[62].id=createText(" M MM .?N ")
a[63].id=createText(" M MM MZ ")
a[64].id=createText(" M MM .7OM: ")
a[65].id=createText(" M MM ??MO$.. ")
a[66].id=createText(" M MM MM:N ")
a[67].id=createText(" M MM .MM ")
a[68].id=createText(" M MM MM ")
a[69].id=createText(" M MM MM ")
a[70].id=createText(" M MM MM ")
a[71].id=createText(" M. MM MM ")
a[72].id=createText(" MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM ")
RETURN
"I like offending people, because I think people who get offended should be offended." - Linus Torvalds