mirror of
https://github.com/stevenhowes/GoRetro.git
synced 2026-05-26 15:53:31 +01:00
Ditch keyboard mover, shooter, interval shooter. All of that is game code not engine. Added key handler and scheduler. Can also now duplicate components on an element (key readers for example)
This commit is contained in:
+5
-1
@@ -61,7 +61,7 @@ func (elem *Element) collision(other *Element) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (elem *Element) AddComponent(new component) {
|
||||
func (elem *Element) AddComponentUnique(new component) {
|
||||
for _, existing := range elem.components {
|
||||
if reflect.TypeOf(new) == reflect.TypeOf(existing) {
|
||||
panic(fmt.Sprintf(
|
||||
@@ -69,6 +69,10 @@ func (elem *Element) AddComponent(new component) {
|
||||
reflect.TypeOf(new)))
|
||||
}
|
||||
}
|
||||
elem.AddComponent(new)
|
||||
}
|
||||
|
||||
func (elem *Element) AddComponent(new component) {
|
||||
elem.components = append(elem.components, new)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user