It looks like you're new here. If you want to get involved, click one of these buttons!
Points = Core.class(Sprite) function Points:init(gameLevel) self.gameLevel = gameLevel self.points = {} self.loadPoints(); end function Points:loadPoints() file = io.open("game-" .. self.gameLevel .. ".txt", "r") local line = file:read("*line") while line~=nil do local splited = line.split(" ") self.points[#self.points + 1] = {x = splited[0], y = splited[1], cc = splited[2]} line = file:read("*line") end end |
Comments
self.loadPoints() to self:loadPoints() so that when it is called it knows who is 'self'
(so usually it's better to call a function using ':' instead of '.')
Fragmenter - animated loop machine and IKONOMIKON - the memory game
not to diminish your method, but you could do it all much easier with some abstraction
http://giderosmobile.com/tools&search&category=11
Thanks for your replies.