Created
June 15, 2011 03:14
-
-
Save russplaysguitar/1026409 to your computer and use it in GitHub Desktop.
First attempt at file reading for lovely-snake
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
| | |
| | |
| | |
+ | | |
+ | | |
+ | | |
+ | | |
| | |
| | |
| |
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
--put this in love.draw() within main.lua | |
-- Draw the level | |
io.input('lovely-snake/1.level') -- this should be moved somewhere where it is only called once | |
local x=1 | |
local y=1 | |
level_drawn=false | |
while true do | |
x = x+1 | |
char = io.read(1) | |
if not char then | |
level_drawn=true | |
break | |
end | |
print(char) | |
if char == "|" then | |
y = y+1 | |
end | |
if char == "+" then | |
love.graphics.rectangle("fill", x, y, block_size, block_size) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rad, can't wait