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
Well, I've been looking around at other projects and such and this snippet as well trying to figure out how we could get this to work. I think I've got something pretty great going which I should have up soon in a pretty big update. This update should also solve most of the problems with the resolutions and such that I was talking about too with a very cool new feature, it's pretty awesome. Should have it done soon.