diff --git a/src/main.go b/src/main.go index 207b793..901d06d 100644 --- a/src/main.go +++ b/src/main.go @@ -187,7 +187,8 @@ func (g *Game) Update() error { g.PlaySound("boop") } - if g.Save.Points > 0 && g.Save.Points%100 == 0 { + /////////// TODO + if g.Save.Points > 0 && g.Save.Points%100 < uint64(g.Save.Level) { // Level progression g.Save.Level++ g.Save.PassiveIncome++ @@ -243,7 +244,6 @@ func (g *Game) Draw(screen *ebiten.Image) { capybaraKey = "capybara3" } - scale := 10.0 op = &ebiten.DrawImageOptions{} if g.AnimationData.BounceDirectionFlag { g.AnimationData.Theta += 0.001 @@ -251,16 +251,22 @@ func (g *Game) Draw(screen *ebiten.Image) { g.AnimationData.Theta -= 0.001 } - op.GeoM.Scale(scale+g.AnimationData.Squish, scale-g.AnimationData.Squish) - + capybaraBounds := g.ImageResources[capybaraKey].Bounds() + scaleX := float64(screen.Bounds().Dx()) / float64(capybaraBounds.Dx()) / 2.5 + scaleY := float64(screen.Bounds().Dy()) / float64(capybaraBounds.Dy()) / 2.5 + op.GeoM.Scale( + scaleX+g.AnimationData.Squish, + scaleY-g.AnimationData.Squish, + ) op.GeoM.Rotate(g.AnimationData.Theta) - width := g.ImageResources[capybaraKey].Bounds().Dx() * int(scale) - height := g.ImageResources[capybaraKey].Bounds().Dy() * int(scale) + capyWidth := float64(g.ImageResources[capybaraKey].Bounds().Dx()) * scaleX + capyHeight := float64(g.ImageResources[capybaraKey].Bounds().Dy()) * scaleY op.GeoM.Translate( - float64(screen.Bounds().Dx()/2)-float64(width/2), - float64(screen.Bounds().Dy()/2)-float64(height/2), + float64(screen.Bounds().Dx()/2)-capyWidth/2, + float64(screen.Bounds().Dy()/2)-capyHeight/2, ) + screen.DrawImage(g.ImageResources[capybaraKey], op) // Points diff --git a/src/resources/capybara_2.png b/src/resources/capybara_2.png index 873d4d8..fc9842a 100644 Binary files a/src/resources/capybara_2.png and b/src/resources/capybara_2.png differ diff --git a/src/resources/capybara_3.png b/src/resources/capybara_3.png index fc9842a..873d4d8 100644 Binary files a/src/resources/capybara_3.png and b/src/resources/capybara_3.png differ diff --git a/src/save/save.go b/src/save/save.go index 2bf093e..6b39885 100644 --- a/src/save/save.go +++ b/src/save/save.go @@ -30,7 +30,7 @@ const CurrentVersion uint8 = 1 type Save struct { SaveVersion uint8 `json:"saveVersion"` Points uint64 `json:"points"` - Level uint8 `json:"level"` + Level uint32 `json:"level"` CreatedUnix uint64 `json:"createdUnix"` LastOpenedUnix uint64 `json:"lastOpenedUnix"` TimesClicked uint64 `json:"timesClicked"`