Skip to content

Commit 10076b6

Browse files
author
James Brundage
committed
feat: Turtle.Forward() ( Fixes #6 )
1 parent 93dafc2 commit 10076b6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Types/Turtle/Forward.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
param(
2+
[double]
3+
$Distance = 10
4+
)
5+
6+
$x = $Distance * [math]::round([math]::cos($this.Heading * [Math]::PI / 180),15)
7+
$y = $Distance * [math]::round([math]::sin($this.Heading * [Math]::PI / 180),15)
8+
$this.Position = $x, $y
9+
$this.Steps += "l $x $y"

0 commit comments

Comments
 (0)