Re: PÄSSION: object-oriented LÖVE
Posted: Mon Feb 15, 2010 9:00 am
Last night I implemented the first version of stackable states on MiddleClass.
I'm sure it's buggy - haven't done proper testing yet. But if anyone feels adventurous... the new code is on the SVN.
I'll try to do some testing during this week.
I haven't given up on implementing some sort of observation pattern - just putted it on the backburner, the stackable states sounded more fun to program
By the way , I accept suggestions on this matter. I'm specially interested on the "registration" interface. This is what I have in mind right now. Please let me know what you guys think - function names, structure, etc.
Oh and I forgot to answer to this one the other day:
I'm sure it's buggy - haven't done proper testing yet. But if anyone feels adventurous... the new code is on the SVN.
I'll try to do some testing during this week.
I haven't given up on implementing some sort of observation pattern - just putted it on the backburner, the stackable states sounded more fun to program
By the way , I accept suggestions on this matter. I'm specially interested on the "registration" interface. This is what I have in mind right now. Please let me know what you guys think - function names, structure, etc.
Code: Select all
Player = passion.actor.subclass('Player')
function Player:startListening()
self:listen('keypress', 'a', self.goLeft)
self:listen('keypress', 'd', self.goRight)
self:listen('mousepress', 'l', self.setTarget)
end
function Player:stopListening()
self:ignore('keypress', 'a')
self:ignore('keypress', 'd')
self:ignore('mousepress', 'l')
end
function Player:goLeft()
print('left')
end
function Player:goRight()
print('right')
end
function Player:setTarget(x,y)
print('My target is :' .. x .. ', ' .. y)
end
I have thought a bit about object serialization, and networking (I consider them two different problems, by the way). But PÄSSION 1.0 will not have them, but they are not discarded from future versions. If they do, serialization will come first, since it seems an order of magnitude easier to implement than networking.By the way, have you thought about saving&loading, and sending over networks? You want this too to be simple and by storing userdata in the tables, this might not be possible.