//
// Happy Birthday ...
//
SetOrientationAllowed(1, 1, 1, 1)
SetVirtualResolution (640, 400)
SetRandomSeed(1933)
LoadMusic(1, "kkst.mp3")
PlayMusic(1,0)
bdi = LoadImage("back.png")
bds = CreateSprite(bdi)
SetSpriteSize(bds, 640, 400)
CreateText(1, " Happy Birthday Dieter ...")
CreateText(2, "Alles Gute zum Geburtstag! Liebe Gruesse von Ingo und Kulle.")
CreateText(3, "Das sind genau 200 Sterne und fuer jeden hast Du einen Wunsch frei.")
CreateText(4, " ... und ein paar Sterne fuer dich.")
CreateText(5, "Und zum Finale gibt es noch ein paar bunte Luftballons.")
txt = LoadImage("custom.png")
SetTextSize(1, 32)
SetTextSize(2, 64)
SetTextSize(3, 64)
SetTextSize(4, 32)
SetTextSize(5, 64)
for t = 1 to 5
SetTextFontImage(t, txt)
SetTextPosition(t, 640, 0)
for i = 0 to GetTextLength(t)
SetTextCharColor(t, i, random(0, 255), random(0, 255), random(0, 255), 255)
next i
next t
type Stars
dx as float
dy as float
da as float
ca as integer
endtype
type Balls
dx as integer
dy as integer
endtype
dim Star[200] as Stars
dim Ball[5] as Balls
star = LoadImage("star.png")
for i = 1 to 200
Star[i].dx = RandomSign(Random(0, 64)) * 0.1
Star[i].dy = RandomSign(Random(0, 40)) * 0.1
Star[i].da = RandomSign(Random(1, 32)) * 0.1
CreateSprite(i, star)
SetSpritePosition(i, -100, -100)
SetSpriteColorAlpha(i, 0)
next i
for i = 1 to 5
Ball[i].dx = RandomSign(Random(1, 3))
Ball[i].dy = RandomSign(Random(1, 3))
ball = LoadImage(Str(i) + ".png")
CreateSprite(200 + i, ball)
SetSpritePosition(200 + i, -100, -100)
SetSpriteColorAlpha(200 + i, 224)
next i
repeat
x# = x# - 1.5
SetTextPosition(1, 640 + x# * 0.5, 0)
for i = 0 to GetTextLength(1)
SetTextCharY(1, i, 32 + cos(x# - i * 8) * 32)
next i
SetTextPosition(2, 640 + x#, 275)
for i = 0 to GetTextLength(2)
SetTextCharY(2, i, sin(x# - i * 16) * 64)
next i
Sync()
until Abs(x# + 640) > GetTextTotalWidth(2)
x# = 0
repeat
x# = x# - 1.5
SetTextPosition(3, 640 + x#, 0)
for i = 0 to GetTextLength(3)
SetTextCharY(3, i, 64 + sin(x# - i * 16) * 64)
next i
SetTextPosition(4, 640 + x# * 0.5, 305)
for i = 0 to GetTextLength(4)
SetTextCharY(4, i, cos(x# - i * 16) * 64)
next i
for i = 1 to 200
sx# = GetSpriteX(i) + Star[i].dx
sy# = GetSpriteY(i) + Star[i].dy
sa# = GetSpriteAngle(i) + Star[i].da
inc Star[i].ca, 3
if sx# < -32 or sy# < -32 or sx# > 672 or sy# > 432
sx# = 304 : sy# = 194 : Star[i].ca = 0
endif
SetSpritePosition(i, sx#, sy#)
SetSpriteAngle(i, sa#)
SetSpriteColorAlpha(i, Star[i].ca)
next i
Sync()
until Abs(x# + 640) > GetTextTotalWidth(3)
x# = 0
for i = 1 to 5
SetSpritePosition(200 + i, Random(0, 580), Random(0, 302))
next i
repeat
x# = x# - 1.5
SetTextPosition(5, 640 + x#, 175)
for i = 0 to GetTextLength(2)
SetTextCharY(5, i, sin(x# - i * 16) * 150)
next i
for i = 1 to 200
sx# = GetSpriteX(i) + Star[i].dx
sy# = GetSpriteY(i) + Star[i].dy
sa# = GetSpriteAngle(i) + Star[i].da
inc Star[i].ca, 3
if sx# < -32 or sy# < -32 or sx# > 672 or sy# > 432
sx# = 304 : sy# = 194 : Star[i].ca = 0
endif
SetSpritePosition(i, sx#, sy#)
SetSpriteAngle(i, sa#)
SetSpriteColorAlpha(i, Star[i].ca)
next i
for i = 1 to 5
sx# = GetSpriteX(200 + i) + Ball[i].dx
sy# = GetSpriteY(200 + i) + Ball[i].dy
if sx# < 0 or sx# > 580
Ball[i].dx = 0 - Ball[i].dx
endif
if sy# < 0 or sy# > 302
Ball[i].dy = 0 - Ball[i].dy
endif
SetSpritePosition(200 + i, sx#, sy#)
SetSpriteScale(200 + i, 1 + sin(x#) * 0.5, 1 + sin(x#) * 0.5)
next i
Sync()
until GetMusicPlaying() = 0
end
Happy Birthday Demo