gamelost/glc-client — pull request #118 by alanjcfs (2014-11-13 06:07:50+00:00)
Title: Move main player logic to sprites/player.lua

# You probably don't want to merge this yet.

The goal is to do #115. Currently, player is extracted to sprites/player.lua, and it's possible to move around, but collision and bullets are disabled. Also, I haven't yet tested whether other players are visible. This will conflict with @cantsin's #117 .

Restore some stuff back to main.lua

Remove updateTimer

Add TODOs

glcd-handlers need to be rewritten

It is adding to otherPlayers when it shouldn't necessarily be
responsible for doing that. My thinking is that glcd-handlers should be
handing off the message to an appropriate "Sprite Handlers" that can
then attach it to the appropriate list of sprites.

Right now, it's just the glcd-handlers checking every message and then
deciding, "Okay, this is a player, let's add it to the otherPlayers
list, Okay, this is a Bullet, let's add it to the spriteList".

My thinking is that the glcd-handlers should simply pass off the message
Type, for example, if it is a Sprite, and the type is a Bullet, then it
will call Gamelost.Sprite.Bullet.new. It could be constructed like

if msg indicates it is a Sprite with status update then
call Gamelost.Sprite[msg.type].new(msg.data)
else
do something else

Move killVerbs to bullet.lua since it's used there

turn glcd-handlers into local functions

No more use of otherPlayers, now need to figure out how to draw

Move drawText and drawHealthBar above drawPlayer because they must be defined first

Allow player to move around (no collision or bullet)