FPS counter in settings
This commit is contained in:
@@ -7,10 +7,7 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
// ============================================================
|
||||
// CONFIGURATION
|
||||
// Tweak these values to change gameplay behavior
|
||||
// ============================================================
|
||||
// Default values and gameplay constants.
|
||||
|
||||
const (
|
||||
// Default values if not specified in config
|
||||
@@ -32,10 +29,6 @@ const (
|
||||
exhaustedThreshold = 0.2 // Show exhausted state below 20% stamina
|
||||
)
|
||||
|
||||
// ============================================================
|
||||
// TYPES
|
||||
// ============================================================
|
||||
|
||||
type Input struct {
|
||||
Left bool
|
||||
Right bool
|
||||
@@ -104,10 +97,6 @@ type Config struct {
|
||||
StaminaRegen float64
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// INITIALIZATION
|
||||
// ============================================================
|
||||
|
||||
func New(cfg Config) *Hero {
|
||||
if cfg.Radius <= 0 {
|
||||
cfg.Radius = defaultRadius
|
||||
@@ -146,10 +135,6 @@ func New(cfg Config) *Hero {
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// UPDATE
|
||||
// ============================================================
|
||||
|
||||
func (h *Hero) Update(input Input, dt float64, bounds Bounds) {
|
||||
h.updateMovement(input, dt, bounds)
|
||||
h.updateStamina(input, dt)
|
||||
@@ -242,10 +227,6 @@ func (h *Hero) updateAnimation(input Input, dt float64) {
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// STATE
|
||||
// ============================================================
|
||||
|
||||
func (h *Hero) getVisualState() VisualState {
|
||||
if h.Stamina < h.MaxStamina*exhaustedThreshold {
|
||||
return StateExhausted
|
||||
@@ -258,10 +239,6 @@ func (h *Hero) getVisualState() VisualState {
|
||||
return StateIdle
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// RENDERING
|
||||
// ============================================================
|
||||
|
||||
func (h *Hero) Draw(screen *ebiten.Image) {
|
||||
sprite := h.getCurrentSprite()
|
||||
|
||||
@@ -319,10 +296,6 @@ func (h *Hero) getCurrentSprite() *ebiten.Image {
|
||||
return sprite
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// UTILITIES
|
||||
// ============================================================
|
||||
|
||||
func clamp(value, min, max float64) float64 {
|
||||
if value < min {
|
||||
return min
|
||||
|
||||
Reference in New Issue
Block a user