NibbleNut wrote: ↑Wed May 07, 2025 12:28 am
ok..ya, that works. Ok, awesome. There were just some commands that didn't work like boxfill, etc but beast runs well so I'll go with that.
\Thanks again.
Update: Working well. Learning lots. I can see that this is a new basic though and not the original C64 with Sprites. Recall, I can run the original under C64 forever but cannot save my programs.
Anyway, here is what I've been playing around with. Still early stages but makes me smile. Replace sounds and images as you see fit OR comment them out.
SNAKE GAME
Dim intNumSquares
Dim intX
Dim intY
Dim X
Dim Y
Dim SnakeX[6]
Dim SnakeY[6]
Dim Count
Dim Code
Sub Delay(lngDelay)
For i=1 to lngDelay:next
End sub
Sub GameOver()
Clearcanvas()
Loadimage(0,"Untitled.xcf")
Drawimage(0,0,0)
Rect(0,0,600,400)
Update()
Waitkey()
end
End sub
intX=10:intY=0 '**Direction
X=50 '** Location
Y=50
intNumSquares=6
Count=0
WindowOpen(0, "Snake Game", 1, 0, 620, 420, WINDOW_VISIBLE, 1)
CanvasOpen(0, 620, 800, 10, 10, 620, 420, 0)
Canvas(0)
SnakeX[0]=10:SnakeY[0]=10
SnakeX[1]=-1:SnakeY[1]=-1
SnakeX[2]=-22:SnakeY[2]=-22
SnakeX[3]=-33:SnakeY[3]=-33
Loadimage(1,"ixc59ldr3cd91.xcf")
SetColor(RGB(255,0,0))
Update()
While True
Rect(0,0,600,400)
Drawimage(1,100,100)
Drawimage(1,400,300)
Drawimage(1,50,300)
Drawimage(1,400,75)
Rectfill(SnakeX[0],SnakeY[0],10,10)
Rectfill(SnakeX[1],SnakeY[1],10,10)
Rectfill(SnakeX[2],SnakeY[2],10,10)
Rectfill(SnakeX[3],SnakeY[3],10,10)
Update()
Code=Inkey$
select case Code
case K_RIGHT
intX=10
intY=0
case K_DOWN
intX=0
intY=10
case K_UP
intX=0
intY=-10
case K_LEFT
intX=-10
intY=0
Default
end select
SnakeX[3]=SnakeX[2]
SnakeY[3]=SnakeY[2]
SnakeX[2]=SnakeX[1]
SnakeY[2]=SnakeY[1]
SnakeX[1]=SnakeX[0]
SnakeY[1]=SnakeY[0]
SnakeX[0]=SnakeX[0]+intX
SnakeY[0]=SnakeY[0]+intY
ClearCanvas()
'***** Check for boundaries
if SnakeX[0]>=600 or SnakeX[0]<=1 then
Loadsound(0,"hitWall.wav")
Playsound(0,1,1)
Delay(8000000)
Gameover()
end if
if SnakeY[0]>=400 or SnakeY[0]<=1 then
Loadsound(0,"hitWall.wav")
Playsound(0,1,1)
Delay(8000000)
Gameover()
end if
'***** Check for collision
Print Getpixel(SnakeX[0],SnakeY[0]);SnakeX[0];SnakeY[0]
if Getpixel(SnakeX[0]-intX,SnakeY[0])<>4278190080 and Getpixel(SnakeX[0]-intX,SnakeY[0])<>4294901760 then
Print Getpixel(SnakeX[0],SnakeY[0])
Loadsound(0,"hitWall.wav")
Playsound(0,1,1)
Delay(8000000)
Gameover()
end if
Delay(5000000)
wend