Skip to content

Instantly share code, notes, and snippets.

@russplaysguitar
Created June 15, 2011 03:14
Show Gist options
  • Save russplaysguitar/1026409 to your computer and use it in GitHub Desktop.
Save russplaysguitar/1026409 to your computer and use it in GitHub Desktop.
First attempt at file reading for lovely-snake
|
|
|
+ |
+ |
+ |
+ |
|
|
|
--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
@russplaysguitar
Copy link
Author

rad, can't wait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment