Class | Turtle |
In: |
Turtle.rb
|
Parent: | LogoTurtle |
This is an inherited class of the LogoTurtle. It includes its own graphical interface to show the turtles and their moves.
Initializes a new Turtle and draws a corresponding pen onto the drawing area of the output window. If no output window exists, a new one will be created.
# File Turtle.rb, line 121 def initialize(posx=0.0, posy=0.0, direction=0.0, color="black", background="white") super if @@application.instance_of?(FXApp) == false @@application = FXApp.new @@window = TurtleWindow.new(@@application, self) @@application.create @@window.show(PLACEMENT_SCREEN) Thread.new { @@application.run } else @@window.addTurtle(self) end @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 146 def backward(distance) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 138 def forward(distance) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 170 def hide super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 210 def home super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 154 def left(degrees) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 202 def move(x, y) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 226 def reset super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 162 def right(degrees) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 194 def setBackground(color) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 186 def setColor(color) super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 178 def show super @@window.refreshTurtle end
Performs the LogoTurtle’s associated method and requests an update from the output window.
# File Turtle.rb, line 218 def turn(direction) super @@window.refreshTurtle end