Skip to content

Instantly share code, notes, and snippets.

@Numbers11
Created November 28, 2018 10:27
Show Gist options
  • Save Numbers11/a5933ea78aa9a84e3b5dbb68d4290416 to your computer and use it in GitHub Desktop.
Save Numbers11/a5933ea78aa9a84e3b5dbb68d4290416 to your computer and use it in GitHub Desktop.
Class Entitity
entity.id
entity.dead
entity.position (als vector oder sonst was)
------
entity.follow vllt?
entity.parent vllt? <- wird gelöscht wenn der parent gelöscht wird
....
entity.nodraw
entity.paused
....
function Entity:addComponent()
function Entity:removeComponent()
function Entity:pauseComponent() <- oder vllt nur entity.paused
----------------------------------------------------
Class Component
component.entity --^ quasi der "Vater"
component.paused
component.nodraw <- entity.nodraw takes priority I guess?
component.update
component.draw (sollte eigentlich nicht gebraucht werden im Allgemeinen. vllt für orbs oder waffen oder so was, aber das wären wahrscheinlich eher selbst entities)
component:init() <-- das und added vielleicht zusammenfassen, weil eine eigenständige initialisierung einer Component keinen Sinn macht (oder?)
component:added()
component:removed()
----------------------------------------------------
dann in
EntityManager:update(dt)
entity:update(dt)
for i in pairs(entity.components)
if not i.paused then
i:update(dt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment