-
-
Save anonymous/c71c6ce4c48553e39500 to your computer and use it in GitHub Desktop.
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
require 'io/console' | |
x, y, guy = 1, 1, '(^u^)' | |
gs = guy.size | |
world = ['####################'] | |
10.times { world << '#' + ' ' * 18 + '#' } | |
world << world[0] | |
world[y][x, gs] = guy | |
loop do | |
print `clear` | |
puts world | |
world[y][x, gs] = ' ' * gs | |
case c = STDIN.getch | |
when ?q; break | |
when ?w; y -= 1 | |
when ?a; x -= 1 | |
when ?s; y += 1 | |
when ?d; x += 1 | |
end | |
world[y][x, gs] = guy | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment