fixed observers, added GameObserver
This commit is contained in:
@@ -10,14 +10,18 @@ type Renderable struct {
|
||||
Image *ebiten.Image
|
||||
}
|
||||
|
||||
type Particle struct {
|
||||
Index int
|
||||
Particles []*ebiten.Image
|
||||
}
|
||||
|
||||
type Speed struct {
|
||||
Value int
|
||||
}
|
||||
|
||||
// only tile entities will have those
|
||||
type Tilish struct{}
|
||||
type Solid struct{}
|
||||
type Floor struct{}
|
||||
type Player struct{}
|
||||
type Collectible struct{}
|
||||
|
||||
type Particle struct {
|
||||
Index int
|
||||
Particles []*ebiten.Image
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ func (position *Position) String() string {
|
||||
)
|
||||
}
|
||||
|
||||
func (position *Position) Move(velocity *Velocity) {
|
||||
position.Update(position.X+velocity.Data.X, position.Y+velocity.Data.Y)
|
||||
func (position *Position) Move(velocity *Velocity, speed *Speed) {
|
||||
position.Update(position.X+(velocity.Data.X*speed.Value), position.Y+(velocity.Data.Y*speed.Value))
|
||||
}
|
||||
|
||||
func (position *Position) Set(newpos *Position) {
|
||||
|
||||
@@ -11,21 +11,19 @@ type Velocity struct {
|
||||
}
|
||||
|
||||
func (velocity *Velocity) Change(direction int) {
|
||||
ticks := 4
|
||||
|
||||
switch direction {
|
||||
case East:
|
||||
velocity.Data.X = ticks
|
||||
velocity.Data.X = 1
|
||||
velocity.Data.Y = 0
|
||||
case West:
|
||||
velocity.Data.X = ticks - (ticks * 2)
|
||||
velocity.Data.X = -1
|
||||
velocity.Data.Y = 0
|
||||
case South:
|
||||
velocity.Data.X = 0
|
||||
velocity.Data.Y = ticks
|
||||
velocity.Data.Y = 1
|
||||
case North:
|
||||
velocity.Data.X = 0
|
||||
velocity.Data.Y = ticks - (ticks * 2)
|
||||
velocity.Data.Y = -1
|
||||
case Stop:
|
||||
velocity.Data.X = 0
|
||||
velocity.Data.Y = 0
|
||||
|
||||
Reference in New Issue
Block a user