pen up/pen down
This commit is contained in:
parent
6e065febaf
commit
5c28ec18e8
1
bun.lock
1
bun.lock
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 0,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "fin",
|
||||
|
|
|
|||
|
|
@ -196,6 +196,14 @@ class Turtle {
|
|||
turtleCtx.restore()
|
||||
}
|
||||
|
||||
pen(dir: string) {
|
||||
switch (dir) {
|
||||
case 'up': this.penup(); break
|
||||
case 'down': this.pendown(); break
|
||||
default: throw "pen only accepts up or down"
|
||||
}
|
||||
}
|
||||
|
||||
penup() {
|
||||
this.penDown = false
|
||||
}
|
||||
|
|
@ -254,6 +262,7 @@ const globals = {
|
|||
back: async (n: number) => await turtle.back(n),
|
||||
left: async (n: number) => await turtle.left(n),
|
||||
right: async (n: number) => await turtle.right(n),
|
||||
pen: (dir) => turtle.pen(dir),
|
||||
penup: () => turtle.penup(),
|
||||
pendown: () => turtle.pendown(),
|
||||
setcolor: (n: number) => turtle.setcolor(n),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user