Skip to content

Instantly share code, notes, and snippets.

@russplaysguitar
Created June 15, 2011 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@jbttn
Copy link

jbttn commented Jun 16, 2011

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.

@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