-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c5871d2
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Type in your code just below here: | ||
require 'gosu' | ||
class MyGame < Gosu::Window | ||
def initialize | ||
super(500, 500, false) | ||
@count = 0 | ||
@position = 50 | ||
end | ||
def update | ||
@text = Gosu::Image.from_text(self, | ||
"KidsRuby", | ||
"Sans", | ||
100) | ||
@count = @count + 1 | ||
if @count > 300 | ||
@position = rand(100) | ||
@count = 0 | ||
else | ||
@position = @position + 1 | ||
end | ||
end | ||
def draw | ||
@text.draw(@position, @position, 1) | ||
end | ||
end | ||
|
||
window = MyGame.new | ||
window.show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Type in your code just below here: | ||
10.times do | ||
puts "KidsRuby is AWESOME!" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Type in your code just below here: | ||
Turtle.draw do | ||
background black | ||
pencolor red | ||
100.times do | ||
distance = rand(100) | ||
turnright rand(25) | ||
forward distance | ||
backward distance | ||
end | ||
end |