Retrogamecoding(.org) > Examples

Snaky

(1/1)

Peter:
Hi,

Another fun here.

--- Code: ---

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()

--- End code ---

Tomaaz:
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:

--- Quote from: Tomaaz 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

--- End quote ---
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!  ::)

Navigation

[0] Message Index

Go to full version