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.
This commit is contained in:
2026-04-26 15:59:44 +02:00
parent ef550044ad
commit ede03ad026
22 changed files with 1237 additions and 482 deletions

View File

@@ -4,18 +4,18 @@ import "github.com/go-gl/mathgl/mgl64"
// Entity definierar alla bas-objekt i varlden
type Entity interface {
Pos() mgl64.Vec3
SetPos(pos mgl64.Vec3)
IsBlocking() bool
IsMovable() bool
Pos() mgl64.Vec3
SetPos(pos mgl64.Vec3)
IsBlocking() bool
IsMovable() bool
IsClimbable() bool
Move(dx, dy, dz float64)
Damage(amount int)
Pickup() bool
GetHealth() int
Move(dx, dy, dz float64)
Damage(amount int)
Pickup() bool
GetHealth() int
// Ritar ut framkallningen av spriten
// sideView: ifall vi ritar från sidan (vänster) eller uppifrån (höger)
DrawSide(screen interface{}, x, y float64, tint, alpha float32)
DrawTop(screen interface{}, x, y float64, tint, alpha float32)
// Ritar ut framkallningen av spriten
// sideView: ifall vi ritar från sidan (vänster) eller uppifrån (höger)
DrawSide(screen interface{}, x, y float64, alpha float32)
DrawTop(screen interface{}, x, y float64, alpha float32)
}

View File

@@ -6,11 +6,11 @@ import (
)
type Tile struct {
pos mgl64.Vec3
health int
Climbable bool
SideImg *ebiten.Image
TopImg *ebiten.Image
pos mgl64.Vec3
health int
Climbable bool
SideImg *ebiten.Image
TopImg *ebiten.Image
}
func (t *Tile) Pos() mgl64.Vec3 { return t.pos }
@@ -25,22 +25,24 @@ 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, tint, alpha float32) {
func (t *Tile) DrawSide(screen interface{}, x, y float64, alpha float32) {
scr := screen.(*ebiten.Image)
if t.SideImg != nil {
op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(x, y)
op.ColorScale.Scale(tint, tint, tint, alpha)
_, 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, tint, alpha float32) {
func (t *Tile) DrawTop(screen interface{}, x, y float64, alpha float32) {
scr := screen.(*ebiten.Image)
if t.TopImg != nil {
op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(x, y)
op.ColorScale.Scale(tint, tint, tint, alpha)
_, 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)
}
}

View File

@@ -84,34 +84,36 @@ func (p *Portal) Move(dx, dy, dz float64) {}
func (p *Portal) Damage(amount int) {}
func (p *Portal) Pickup() bool { return false }
func (p *Portal) GetHealth() int { return 100 }
func (p *Portal) DrawSide(screen interface{}, x, y float64, tint, alpha float32) {
func (p *Portal) DrawSide(screen interface{}, x, y float64, alpha float32) {
scr := screen.(*ebiten.Image)
if p.SideImg != nil {
op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(x, y)
op.ColorScale.Scale(tint, tint, tint, alpha)
_, sh := p.SideImg.Bounds().Dx(), p.SideImg.Bounds().Dy()
op.GeoM.Translate(x, y-float64(sh-int(TileSize)))
op.ColorScale.Scale(alpha, alpha, alpha, alpha)
scr.DrawImage(p.SideImg, op)
}
}
func (p *Portal) DrawTop(screen interface{}, x, y float64, tint, alpha float32) {
func (p *Portal) DrawTop(screen interface{}, x, y float64, alpha float32) {
scr := screen.(*ebiten.Image)
if p.TopImg != nil {
op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(x, y)
op.ColorScale.Scale(tint, tint, tint, alpha)
_, sh := p.TopImg.Bounds().Dx(), p.TopImg.Bounds().Dy()
op.GeoM.Translate(x, y-float64(sh-int(TileSize)))
op.ColorScale.Scale(alpha, alpha, alpha, alpha)
scr.DrawImage(p.TopImg, op)
}
}
// EntityDef definierar egenskaperna för ett tile-id
type EntityDef struct {
ID int `json:"id"`
TiledID int `json:"tiled_id"`
Solid bool `json:"solid"`
Climbable bool `json:"climbable,omitempty"`
TargetMap string
SideImg *ebiten.Image
TopImg *ebiten.Image `json:"target_map,omitempty"`
ID int `json:"id"`
TiledID int `json:"tiled_id"`
Solid bool `json:"solid"`
Climbable bool `json:"climbable,omitempty"`
TargetMap string `json:"target_map,omitempty"`
SideImg *ebiten.Image `json:"-"`
TopImg *ebiten.Image `json:"-"`
Sprites struct {
Top string `json:"top"`
Side string `json:"side"`