Skip to content

Commit

Permalink
feat: show score
Browse files Browse the repository at this point in the history
  • Loading branch information
demouth committed Jan 21, 2024
1 parent 99b8338 commit 1a24f90
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
@@ -1,11 +1,13 @@
package main

import (
"fmt"
"log"
"math/rand"
"time"

"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
)

const (
Expand Down Expand Up @@ -66,6 +68,12 @@ func (g *Game) Draw(screen *ebiten.Image) {
draw.World(screen, world)
draw.Fruit(screen, world, next)
draw.Fruits(screen, world, fruits)
msg := fmt.Sprintf(
"<-: move left\n->: move right\nspace: drop fruit\nSCORE: %d\nFPS: %0.2f",
calc.Score,
ebiten.ActualFPS(),
)
ebitenutil.DebugPrint(screen, msg)
}

func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
Expand Down

0 comments on commit 1a24f90

Please sign in to comment.