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