slow down yawn and sleep animations

This commit is contained in:
Raffaele Sena
2023-02-03 16:33:30 -08:00
parent fe4a01519a
commit c742a9c01c

12
main.go
View File

@@ -35,6 +35,8 @@ type neko struct {
y int
distance int
count int
min int
max int
state int
sprite string
}
@@ -84,6 +86,8 @@ func (m *neko) Update() error {
m.sprite = "wash"
case 10, 11, 12:
m.min = 32
m.max = 64
m.sprite = "yawn"
default:
@@ -94,6 +98,8 @@ func (m *neko) Update() error {
}
m.state = 0
m.min = 8
m.max = 16
tr := 0.0
// get mouse direction
@@ -155,13 +161,13 @@ func (m *neko) Draw(screen *ebiten.Image) {
switch {
case m.sprite == "awake":
img = mSprite[m.sprite]
case m.count < 8:
case m.count < m.min:
img = mSprite[m.sprite+"1"]
default:
img = mSprite[m.sprite+"2"]
}
if m.count > 16 {
if m.count > m.max {
m.count = 0
if m.state > 0 {
@@ -203,6 +209,8 @@ func main() {
n := &neko{
x: sw / 2,
y: sh / 2,
min: 8,
max: 16,
}
ebiten.SetScreenTransparent(true)