Snake: Difference between revisions
Content added Content deleted
Line 2,293: | Line 2,293: | ||
=={{header|EasyLang}}== |
=={{header|EasyLang}}== |
||
[https://easylang.dev/apps/ |
[https://easylang.dev/apps/snake.html Run it] |
||
{{Trans|Craft Basic}} |
{{Trans|Craft Basic}} |
||
<syntaxhighlight lang="easylang"> |
<syntaxhighlight lang="easylang"> |
||
Line 2,314: | Line 2,314: | ||
text "SNAKE" |
text "SNAKE" |
||
textsize 5 |
textsize 5 |
||
move |
move 6 40 |
||
text " |
text "Keys or mouse for controlling" |
||
move |
move 6 30 |
||
text " |
text "Space or click to to start" |
||
# |
# |
||
on key |
on key |
||
if |
if game = 0 and keybkey = " " |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
elif keybkey = " " and game = 0 |
|||
start |
start |
||
return |
|||
. |
|||
if dir mod 2 = 1 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
. |
|||
else |
|||
if keybkey = "ArrowUp" |
|||
⚫ | |||
⚫ | |||
⚫ | |||
. |
|||
. |
|||
. |
|||
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: | Line 2,360: | ||
clear |
clear |
||
color 997 |
color 997 |
||
move 2 |
move 2 95 |
||
text "Score: " & 10 * len sx[] - 50 |
text "Score: " & 10 * len sx[] - 50 |
||
color 966 |
color 966 |
||
Line 2,391: | Line 2,416: | ||
color 997 |
color 997 |
||
move 10 10 |
move 10 10 |
||
text " |
text "Space or click new game" |
||
. |
. |
||
. |
. |