Author Topic: My friend  (Read 3743 times)

Peter

  • Guest
My friend
« on: November 16, 2012, 01:33:30 PM »
Hi,

Do you love it?
I know, there is a built in RAD function of Lua!

Code: [Select]
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()

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: My friend
« Reply #1 on: November 16, 2012, 03:21:56 PM »
It's really awesome what can be done with a few lines of code ...

Bereb

  • Guest
Re: My friend
« Reply #2 on: November 16, 2012, 03:36:37 PM »
Fantastic! 
It reminds me of Ghostbuster
:D

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: My friend
« Reply #3 on: November 16, 2012, 03:42:16 PM »
Who you gonna call?  ;D

Tomaaz

  • Guest
Re: My friend
« Reply #4 on: November 16, 2012, 06:37:16 PM »
Nice, but I have a few questions:

1. Why the topic's title is "My friend"?
2. What are we supposed to love?
3. Is the person we're gonna call... Aurel? ;)

Sorry, but this is a little bit surreal for me.  ;D

Peter

  • Guest
Re: My friend
« Reply #5 on: November 17, 2012, 12:09:40 PM »
Hi Tomaaz,

My friend is  "My friend"
Love means:  Do you you like it?
No,  Aurel is another thing. 

Tomaaz

  • Guest
My sister and her car
« Reply #6 on: November 17, 2012, 01:24:24 PM »
My friend is  "My friend"

Now everything is clear, but you should have said it earlier. :)

Love means:  Do you you like it?

I know what that sentence means. I'm just not sure if we supposed to love your program, the thing on the screen or your friend (in case your friend is not the thing on the screen). :)

No,  Aurel is another thing.

Do you mean... an alien!?  :o
« Last Edit: November 17, 2012, 01:26:58 PM by Tomaaz »

Peter

  • Guest
Re: My friend
« Reply #7 on: November 17, 2012, 02:37:52 PM »
Hi Tomaaz,

understand it,  is my fantasy.
an Alien,  I have never seen an Alien.