more gobs and interface cleanup
This commit is contained in:
parent
66e45e495a
commit
c30472c67e
4 changed files with 20 additions and 6 deletions
|
@ -13,11 +13,6 @@ func init() {
|
|||
// Thorson-style movement:
|
||||
// https://maddythorson.medium.com/celeste-and-towerfall-physics-d24bd2ae0fc5
|
||||
|
||||
// Collider components have tangible form.
|
||||
type Collider interface {
|
||||
CollidesWith(image.Rectangle) bool
|
||||
}
|
||||
|
||||
// Actor handles basic movement.
|
||||
type Actor struct {
|
||||
CollisionDomain string
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
package engine
|
||||
|
||||
import "github.com/hajimehoshi/ebiten/v2"
|
||||
import (
|
||||
"image"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
// Collider components have tangible form.
|
||||
type Collider interface {
|
||||
CollidesWith(image.Rectangle) bool
|
||||
}
|
||||
|
||||
// Drawer components can draw themselves. Draw is called often.
|
||||
// Each component is responsible for calling Draw on its child components.
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"image"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(Sprite{})
|
||||
}
|
||||
|
||||
// Sprite combines an Actor with the ability to Draw from a single spritesheet.
|
||||
type Sprite struct {
|
||||
Actor
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package game
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"image"
|
||||
|
||||
"drjosh.dev/gurgle/engine"
|
||||
|
@ -8,6 +9,10 @@ import (
|
|||
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(Awakeman{})
|
||||
}
|
||||
|
||||
type Awakeman struct {
|
||||
engine.Sprite
|
||||
|
||||
|
|
Loading…
Reference in a new issue