Files
Regin_mountain_of_treasures/internal/entities/tiles.go
Bjorn Blomberg ede03ad026 Update tileset and settings, enhance logging
- Updated tileset configuration in 'tileset.tsj' to include new tiles and adjust dimensions.
- Added 'settings.json' for key bindings related to climbing and movement actions.
- Enhanced game logging in 'game.log' to track game start events and map loading.
- Updated the game binary to the latest version.
2026-04-26 15:59:44 +02:00

49 lines
1.4 KiB
Go

package entities
import (
"github.com/go-gl/mathgl/mgl64"
"github.com/hajimehoshi/ebiten/v2"
)
type Tile struct {
pos mgl64.Vec3
health int
Climbable bool
SideImg *ebiten.Image
TopImg *ebiten.Image
}
func (t *Tile) Pos() mgl64.Vec3 { return t.pos }
func (t *Tile) SetPos(pos mgl64.Vec3) { t.pos = pos }
func (t *Tile) IsBlocking() bool { return !t.Climbable }
func (t *Tile) IsClimbable() bool { return t.Climbable }
func (t *Tile) IsMovable() bool { return false }
func (t *Tile) Move(dx, dy, dz float64) {
// Not feasible for soil etc.
}
func (t *Tile) Damage(am int) { t.health -= am }
func (t *Tile) Pickup() bool { return false }
func (t *Tile) GetHealth() int { return t.health }
func (t *Tile) DrawSide(screen interface{}, x, y float64, alpha float32) {
scr := screen.(*ebiten.Image)
if t.SideImg != nil {
op := &ebiten.DrawImageOptions{}
_, sh := t.SideImg.Bounds().Dx(), t.SideImg.Bounds().Dy()
op.GeoM.Translate(x, y-float64(sh-int(TileSize)))
op.ColorScale.Scale(alpha, alpha, alpha, alpha)
scr.DrawImage(t.SideImg, op)
}
}
func (t *Tile) DrawTop(screen interface{}, x, y float64, alpha float32) {
scr := screen.(*ebiten.Image)
if t.TopImg != nil {
op := &ebiten.DrawImageOptions{}
_, sh := t.TopImg.Bounds().Dx(), t.TopImg.Bounds().Dy()
op.GeoM.Translate(x, y-float64(sh-int(TileSize)))
op.ColorScale.Scale(alpha, alpha, alpha, alpha)
scr.DrawImage(t.TopImg, op)
}
}