Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Snake!
- #
- function snakeGamePadUP(p: player):
- while {snake.dir.%{_p}%} is "UP":
- set {_slot.old} to {snake.slot.%{_p}%}
- {snake.dir.%{_p}%} is "UP"
- subtract 9 from {snake.slot.%{_p}%}
- broadcast "%{snake.dir.%{_p}%}%: from %{_slot.old}% to %{snake.slot.%{_p}%}%"
- if {snake.slot.%{_p}%} is less than 0:
- broadcast "%{_p}% lost %{snake.slot.%{_p}%}%"
- close {_p}'s inventory
- # check for out of bounds
- if {_p}'s slot {snake.slot.%{_p}%} is not cookie:
- add 1 to {snake.points.%{_p}%}
- # set the goal to random slot
- send "Point added" to {_p}
- #else:
- format slot {_slot.old} of {_p} with cookie to run ""
- format slot {snake.slot.%{_p}%} of {_p} with {snake.head.up} to run ""
- wait 20 ticks
- function snakeGamePadDOWN(p: player):
- while {snake.dir.%{_p}%} is "DOWN":
- set {_slot.old} to {snake.slot.%{_p}%}
- {snake.dir.%{_p}%} is "DOWN"
- add 9 to {snake.slot.%{_p}%}
- broadcast "%{snake.dir.%{_p}%}%: from %{_slot.old}% to %{snake.slot.%{_p}%}%"
- if {snake.slot.%{_p}%} is greater than 53:
- broadcast "%{_p}% lost %{snake.slot.%{_p}%}%"
- close {_p}'s inventory
- # check for out of bounds
- if {_p}'s slot {snake.slot.%{_p}%} is not cookie:
- add 1 to {snake.points.%{_p}%}
- # set the goal to random slot
- send "Point added" to {_p}
- #else:
- format slot {_slot.old} of {_p} with cookie to run ""
- format slot {snake.slot.%{_p}%} of {_p} with {snake.head.down} to run ""
- wait 20 ticks
- function snakeGamePadLEFT(p: player):
- while {snake.dir.%{_p}%} is "LEFT":
- set {_slot.old} to {snake.slot.%{_p}%}
- {snake.dir.%{_p}%} is "LEFT"
- subtract 1 from {snake.slot.%{_p}%}
- broadcast "%{snake.dir.%{_p}%}%: from %{_slot.old}% to %{snake.slot.%{_p}%}%"
- if {_slot.old} is 0 or 9 or 18 or 27 or 36 or 45:
- broadcast "%{_p}% lost %{snake.slot.%{_p}%}%"
- close {_p}'s inventory
- # check for out of bounds
- if {_p}'s slot {snake.slot.%{_p}%} is not cookie:
- add 1 to {snake.points.%{_p}%}
- # set the goal to random slot
- send "Point added" to {_p}
- #else:
- format slot {_slot.old} of {_p} with cookie to run ""
- format slot {snake.slot.%{_p}%} of {_p} with {snake.head.left} to run ""
- wait 20 ticks
- function snakeGamePadRIGHT(p: player):
- while {snake.dir.%{_p}%} is "RIGHT":
- set {_slot.old} to {snake.slot.%{_p}%}
- {snake.dir.%{_p}%} is "RIGHT"
- add 1 to {snake.slot.%{_p}%}
- broadcast "%{snake.dir.%{_p}%}%: from %{_slot.old}% to %{snake.slot.%{_p}%}%"
- if {_slot.old} is 8 or 17 or 26 or 35 or 44 or 53:
- broadcast "%{_p}% lost %{snake.slot.%{_p}%}%"
- close {_p}'s inventory
- # check for out of bounds
- if {_p}'s slot {snake.slot.%{_p}%} is not cookie:
- add 1 to {snake.points.%{_p}%}
- # set the goal to random slot
- send "Point added" to {_p}
- #else:
- format slot {_slot.old} of {_p} with cookie to run ""
- format slot {snake.slot.%{_p}%} of {_p} with {snake.head.right} to run ""
- wait 20 ticks
- command /snake:
- aliases: /snake!
- trigger:
- set {snake.head} to a green wool named "&6&lSnakeHead" with lore "&1&lThis is the head of your snake! ||&1&lUse it to eat rats for points. ||&1&lYour tail will grow as you eat! ||&1&lTry to get the longest tail!"
- set {snake.head.up} to a redstone torch named "&6&lSnakeHead" with lore "&1&lThis is the head of your snake! ||&1&lUse it to eat rats for points. ||&1&lYour tail will grow as you eat! ||&1&lTry to get the longest tail!"
- set {snake.head.down} to a tripwire hook named "&6&lSnakeHead" with lore "&1&lThis is the head of your snake! ||&1&lUse it to eat rats for points. ||&1&lYour tail will grow as you eat! ||&1&lTry to get the longest tail!"
- set {snake.head.left} to a flint and steel named "&6&lSnakeHead" with lore "&1&lThis is the head of your snake! ||&1&lUse it to eat rats for points. ||&1&lYour tail will grow as you eat! ||&1&lTry to get the longest tail!"
- set {snake.head.right} to an arrow named "&6&lSnakeHead" with lore "&1&lThis is the head of your snake! ||&1&lUse it to eat rats for points. ||&1&lYour tail will grow as you eat! ||&1&lTry to get the longest tail!"
- open chest with 7 rows named " &l&oSnake!" to player
- wait 1 tick
- set {snake.inv.%player%} to true
- set {_slots} to 7 * 9
- loop {_slots} times:
- {snake.inv.%player%} is true
- set {_num} to loop-number - 1
- format slot {_num} of player with a cake to be unstealable
- set {snake.slot.%player%} to 22
- format slot 22 of player with {snake.head} to run ""
- format slot 54 of player with a redstone torch named "&9&lUP" with lore "&3Click me to face up!" to be unstealable # "snakeGamePad %player% UP"
- format slot 55 of player with a tripwire hook named "&9&lDown" with lore "&3Click me to face down!" to be unstealable # to run "snakeGamePad %player% DOWN"
- format slot 56 of player with a Flint and Steel named "&9&lLEFT" with lore "&3Click me to face left!" to be unstealable # to run "snakeGamePad %player% LEFT"
- format slot 57 of player with an arrow named "&9&lRIGHT" with lore "&3Click me to face right!" to be unstealable # to run "snakeGamePad %player% RIGHT"
- format slot 62 of player with a red wool named "&4&lQUIT" with lore "&3Click me to quit!||There is no way to save a game!" to close
- wait 1 tick
- format slot 40 of player with apple to run "?"
- if 1 is 2:
- loop {_slots} times:
- {snake.inv.%player%} is true
- set {_num} to loop-number - 1
- format slot {_num} of player with a cookie to be unstealable
- wait 1 ticks
- format slot {_num} of player with air to be unstealable
- if {_num} is less than 0:
- broadcast "%player% has lost"
- if {_num} is greater than 52:
- broadcast "%player% has lost"
- close player's inventory
- on inventory close:
- {snake.inv.%player%} is true:
- set {snake.inv.%player%} to false
- delete {snake.dir.%player%}
- on inventory click:
- {snake.inv.%player%} is true:
- if event-item is a redstone torch named "&9&lUP" with lore "&3Click me to face up!":
- set {snake.dir.%player%} to "UP"
- snakeGamePadUP(player)
- if event-item is a tripwire hook named "&9&lDown" with lore "&3Click me to face down!":
- set {snake.dir.%player%} to "DOWN"
- snakeGamePadDOWN(player)
- if event-item is a Flint and Steel named "&9&lLEFT" with lore "&3Click me to face left!":
- set {snake.dir.%player%} to "LEFT"
- snakeGamePadLEFT(player)
- if event-item is an arrow named "&9&lRIGHT" with lore "&3Click me to face right!":
- set {snake.dir.%player%} to "RIGHT"
- snakeGamePadRIGHT(player)
- command /snakeGamePad <player> <text>:
- trigger:
- set {snake.dir.%arg-player%} to arg 2
- if arg 2 is "UP":
- broadcast "%{snake.dir.%arg-player%}%: Stops"
- stop
- set {snake.dir.%arg-player%} to arg 2
- if arg 2 is "DOWN":
- broadcast "%{snake.dir.%arg-player%}%: Stops at %{snake.slot.%arg-player%}%"
- stop
- if arg 2 is "LEFT":
- broadcast "%{snake.dir.%arg-player%}%: Stops"
- stop
- if arg 2 is "RIGHT":
- broadcast "%{snake.dir.%arg-player%}%: Stops"
- stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement