Author Topic: Snaky  (Read 2758 times)

Peter

  • Guest
Snaky
« on: November 16, 2012, 06:30:30 PM »
Hi,

Another fun here.
Code: [Select]


screen(640,590,0,"Snake Ghost")
setframetimer(200)
backcolor(0,0,255)
colorkey(0,0,0)


snk=loadimage("snake/friend.png")
pln=loadimage("snake/plant.png")

function Snake()
   sprite(snk,x[1],y[1],64,64,0)
   sprite(snk,x[2],y[2],64,64,0)
   sprite(snk,x[3],y[3],64,64,0)
   sprite(snk,x[4],y[4],64,64,0)
end

repeat
k=getkey()
cls()
for i=1,4 do
   if z[i]==0 then
      x[i]=x[i]+1
   end
   if x[i] >=640-64 then
      z[i]=1
   end
end
for i=1,4 do
   if z[i]==1 then
      y[i]=y[i]+1
      t[i]=t[i]+1
      if t[i]==40 then
t[i]=0
         z[i]=2
      end
   end
end
for i=1,4 do
   if z[i]==2 then
      x[i]=x[i]+1*(-1)
      if x[i] <=0 then
         z[i]=3
      end
   end
end
for i=1,4 do
   if z[i]==3 then
      y[i]=y[i]+1
      t[i]=t[i]+1
      if t[i]==40 then
         t[i]=0
         z[i]=0
      end
      if y[i]>=screenheight()-64 then
         z[i]=4
      end
end
Snake()
sprite(pln,0,0,640,590,0)
redraw()
until k==27
CloseWindow()
« Last Edit: January 27, 2013, 10:28:17 PM by Peter »

Tomaaz

  • Guest
Re: Snaky
« Reply #1 on: November 16, 2012, 06:43:08 PM »
Doesn't work on Linux, as Linux is case sensitive. ;) But it's easy to fix it and what you see after that is even more surreal than "My friend" topic. ;D

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Snaky
« Reply #2 on: November 16, 2012, 07:19:39 PM »
Doesn't work on Linux, as Linux is case sensitive. ;) But it's easy to fix it and what you see after that is even more surreal than "My friend" topic. ;D
That's why in EGSL one should take care of case sensitive file names. Because it should work on all platforms without changing the code!  ::)