Jump to content

Snake: Difference between revisions

Line 2,293:
 
=={{header|EasyLang}}==
[https://easylang.dev/apps/_snakesnake.html Run it]
{{Trans|Craft Basic}}
<syntaxhighlight lang="easylang">
Line 2,314:
text "SNAKE"
textsize 5
move 106 40
text "ArrowKeys keysor mouse for controlling"
move 106 30
text "PressSpace spaceor click to to start"
#
on key
if keybkeygame = "ArrowUp"0 and dirkeybkey <>= 3" "
dir = 1
elif keybkey = "ArrowRight" and dir <> 4
dir = 2
elif keybkey = "ArrowDown" and dir <> 1
dir = 3
elif keybkey = "ArrowLeft" and dir <> 2
dir = 4
elif keybkey = " " and game = 0
start
return
.
if dir mod 2 = 1
elif if keybkey = "ArrowRight" and dir <> 4
dir = 2
elif keybkey = "ArrowLeft" and dir <> 2
dir = 4
.
else
if keybkey = "ArrowUp"
dir = 1
elif keybkey = "ArrowDown" and dir <> 1
dir = 3
.
.
.
on mouse_down
if game = 0
start
return
.
if dir mod 2 = 1
if mouse_x < sx
dir = 4
else
dir = 2
.
else
if mouse_y < sy
dir = 3
else
dir = 1
.
.
.
Line 2,335 ⟶ 2,360:
clear
color 997
move 2 9695
text "Score: " & 10 * len sx[] - 50
color 966
Line 2,391 ⟶ 2,416:
color 997
move 10 10
text "PressSpace spaceor forclick new game"
.
.
2,041

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.