Author Topic: Moving Clouds  (Read 1859 times)

Peter

  • Guest
Moving Clouds
« on: November 18, 2012, 04:57:11 PM »
Hi,

This clouds make you happy.
Diese Wolken machen dich glücklich.
Code: [Select]
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()

Peter

  • Guest
Re: Moving Clouds
« Reply #1 on: November 18, 2012, 06:27:06 PM »
Another fun.
Code: [Select]
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()