Hi,
Do you love it?
I know, there is a built in RAD function of Lua!
function Sprite(id,x,y,w,h,fx)
drawimage(w*fx,0,w,h,x,y,id)
end
function Rand(minZahl,maxZahl)
maxZahl= (maxZahl-minZahl)
return int(rnd()*maxZahl+minZahl)
end
function Radians(winkel)
return winkel*math.pi/180
end
screen(640,480,0,"Banana Ghost")
setframetimer(28)
backcolor(0,0,0)
colorkey(0,0,0)
headX=0; headY=0; mask=0; cells=3000; i=0
mask =loadimage("ghost/maske2.png")
px={}
py={}
radX={}
radY={}
angle={}
frequency={}
for i=1,cells do
px[i]=0
py[i]=0
radX[i]=0
radY[i]=0
angle[i]=0
frequency[i]=0
end
headX = screenwidth() /2
headY = screenheight()/2
for i=1,cells do
radX[i]=Rand(-7, 7)
radY[i]=Rand(-4, 4)
frequency[i]=Rand(-9, 9)
end
repeat
k=getkey()
cls()
for i=1,cells do
if i==1 then
px[i]=headX+sin(angle[i])*radX[i]
py[i]=headY+cos(angle[i])*radY[i]
else
px[i]=px[i-1]+cos(angle[i])*radX[i]
py[i]=py[i-1]+sin(angle[i])*radY[i]
end
Sprite(mask,px[i],py[i],64,64,0)
angle[i]=angle[i] + Radians(frequency[i])
end
sync()
until k==27
closewindow()