fix vibration, tweak spritesheet

This commit is contained in:
Josh Deprez 2021-08-05 14:26:23 +10:00 committed by Josh Deprez
parent 5cdbf5b82b
commit 8bddc09a11
4 changed files with 4 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 633 B

View file

@ -3,7 +3,6 @@ package engine
import (
"encoding/gob"
"image"
"math"
)
func init() {
@ -40,7 +39,7 @@ func (a *Actor) CollidesAt(p image.Point) bool {
func (a *Actor) MoveX(dx float64, onCollide func()) {
a.xRem += dx
move := int(math.Round(a.xRem))
move := int(a.xRem + 0.5) // Note: math.Round can lead to vibration
if move == 0 {
return
}
@ -60,7 +59,7 @@ func (a *Actor) MoveX(dx float64, onCollide func()) {
func (a *Actor) MoveY(dy float64, onCollide func()) {
a.yRem += dy
move := int(math.Round(a.yRem))
move := int(a.yRem + 0.5)
if move == 0 {
return
}

View file

@ -26,8 +26,8 @@ func (aw *Awakeman) Update() error {
const (
bounceDampen = 0.5
gravity = 0.3
jumpVelocity = -5
runVelocity = 2
jumpVelocity = -3
runVelocity = 1.5
)
// Standing on something?