Retrogamecoding(.org) > Examples
Moving Clouds
(1/1)
Peter:
Hi,
This clouds make you happy.
Diese Wolken machen dich glücklich.
--- Code: ---screen(800,600,0,"Clouds")
backcolor(0,0,0)
setframetimer(200)
function rand(minZahl,maxZahl)
maxZahl= (maxZahl-minZahl)
return int(rnd()*maxZahl+minZahl)
end
i,t,xres,yres = 0,0,800,600
cloudx={}
cloudy={}
clouds={}
for i=1,250 do
cloudx[i]=rand(1,xres-2)
cloudy[i]=rand(1,yres-2)
clouds[i]=rand(1,4)
end
function move_clouds()
for i=1,250 do
alphachannel(55)
color(200,200,200)
fillellipse(cloudx[i],cloudy[i],100,60)
cloudx[i] = cloudx[i]+clouds[i]
if cloudx[i] > xres+128 then
cloudx[i] = -128
cloudy[i] = rand(1,yres -2)
clouds[i] = rand(1,4)
end
end
end
repeat
t=getkey()
alphachannel(255)
cls()
move_clouds()
redraw()
until t==27
closewindow()
--- End code ---
Peter:
Another fun.
--- Code: ---screen(320,240,0,"THEY LAUGH")
backcolor(0,0,0)
colorkey(0,0,0)
function sprite(id,x,y,w,h,fx)
drawimage(w*fx,0,w,h,x,y,id)
end
smy,h,x,y,z = 0,0,0,0,0
smy=loadimage("smy.bmp")
repeat
h=getkey()
cls()
for y=0,240,30 do
for x=0,320,30 do
sprite(smy,x,y,30,30,z)
end
end
z=z+1
if z==18 then
z=0
end
redraw()
wait (30)
until h==27
closewindow()
--- End code ---
Navigation
[0] Message Index
Go to full version