fixed higher speed collisions, removed Speed comp, put into Velocity
This commit is contained in:
@@ -16,10 +16,6 @@ type Particle struct {
|
||||
Tiles []*ebiten.Image
|
||||
}
|
||||
|
||||
type Speed struct {
|
||||
Value int
|
||||
}
|
||||
|
||||
// only tile entities will have those
|
||||
type Tilish struct{}
|
||||
type Solid struct{}
|
||||
|
||||
@@ -34,7 +34,8 @@ func NewPosition(point image.Point, cellsize int) *Position {
|
||||
|
||||
func (position *Position) GetMoved(velosity *Velocity) *Position {
|
||||
pos := &Position{}
|
||||
pos.Update(position.X+velosity.Data.X, position.Y+velosity.Data.Y, position.Cellsize)
|
||||
pos.Update(position.X+(velosity.Data.X*velosity.Speed),
|
||||
position.Y+(velosity.Data.Y*velosity.Speed), position.Cellsize)
|
||||
|
||||
return pos
|
||||
}
|
||||
@@ -70,13 +71,13 @@ func (position *Position) String() string {
|
||||
)
|
||||
}
|
||||
|
||||
func (position *Position) Move(velocity *Velocity, speed *Speed) {
|
||||
func (position *Position) Move(velocity *Velocity) {
|
||||
// if velocity.Direction != 0 {
|
||||
// slog.Debug("moving", "velocity", velocity, "speed", speed)
|
||||
// }
|
||||
position.Update(
|
||||
position.X+(velocity.Data.X*speed.Value),
|
||||
position.Y+(velocity.Data.Y*speed.Value),
|
||||
position.X+(velocity.Data.X*velocity.Speed),
|
||||
position.Y+(velocity.Data.Y*velocity.Speed),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ type Velocity struct {
|
||||
Data Position
|
||||
Direction int
|
||||
PointingAt int
|
||||
Speed int
|
||||
}
|
||||
|
||||
func (velocity *Velocity) Set(new *Velocity) {
|
||||
|
||||
Reference in New Issue
Block a user