Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Last active March 23, 2019 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielflorit/35a046320df3d95088cba7a481bc33fe to your computer and use it in GitHub Desktop.
Save gabrielflorit/35a046320df3d95088cba7a481bc33fe to your computer and use it in GitHub Desktop.
SCRIPT-8
initialState = {
x: 60,
y: 60
}
update = (state, input) => {
state.x = input.left ? state.x - 1 : input.right ? state.x + 1 : state.x
state.y = input.up ? state.y - 1 : input.down ? state.y + 1 : state.y
}
draw = state => {
clear(6)
rectFill(state.x, state.y, 8, 8, 0)
}
{
"iframeVersion": "0.1.246",
"lines": [
15,
0,
0,
0,
0,
0,
0,
0
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment