Created
February 18, 2021 01:14
-
-
Save creaturenex/f336a1d92c3c8d55a6d5901295191f0b to your computer and use it in GitHub Desktop.
space_invader
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
class Invader | |
def initialize | |
self.animate | |
end | |
def down | |
puts " ▒▒ ▒▒" | |
puts " ▒▒ ▒▒" | |
puts " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒" | |
puts " ▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒" | |
puts " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" | |
puts " ▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒" | |
puts " ▒▒ ▒▒ ▒▒ ▒▒" | |
puts " ▒▒▒▒ ▒▒▒▒" | |
end | |
def up | |
puts " ▒▒ ▒▒" | |
puts " ▒▒ ▒▒ ▒▒ ▒▒" | |
puts " ▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒" | |
puts " ▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒" | |
puts " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" | |
puts " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" | |
puts " ▒▒ ▒▒" | |
puts " ▒▒ ▒▒" | |
end | |
def animate | |
10.times do | |
system('clear') | |
self.down | |
sleep (0.5) | |
system('clear') | |
self.up | |
sleep(0.5) | |
end | |
end | |
end | |
alien = Invader.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment