fixes
This commit is contained in:
@@ -31,6 +31,7 @@ func Build() *p.Game {
|
|||||||
// in the corner just gets in the way. Pass "player" as the second
|
// in the corner just gets in the way. Pass "player" as the second
|
||||||
// arg to put it back.
|
// arg to put it back.
|
||||||
p.RegisterRichUI(g, "", "cat")
|
p.RegisterRichUI(g, "", "cat")
|
||||||
|
g.UIManager.Register(&saveKeys{})
|
||||||
g.MaxLogLines = 64
|
g.MaxLogLines = 64
|
||||||
|
|
||||||
// initial HUD vars
|
// initial HUD vars
|
||||||
|
|||||||
@@ -11,6 +11,17 @@ func defineBedroom(g *p.Game) {
|
|||||||
Actors: []p.SceneActor{
|
Actors: []p.SceneActor{
|
||||||
{CharacterName: "player", At: p.Point{X: 160, Y: 145}},
|
{CharacterName: "player", At: p.Point{X: 160, Y: 145}},
|
||||||
},
|
},
|
||||||
|
// Floor strip — Walk targets get clipped to this band, so clicks
|
||||||
|
// on the bed or nightstand send the player to the floor in front
|
||||||
|
// of them instead of letting them clip through furniture.
|
||||||
|
Walkboxes: []p.Polygon{
|
||||||
|
p.Poly(
|
||||||
|
p.Point{X: 10, Y: 135},
|
||||||
|
p.Point{X: 310, Y: 135},
|
||||||
|
p.Point{X: 310, Y: 160},
|
||||||
|
p.Point{X: 10, Y: 160},
|
||||||
|
),
|
||||||
|
},
|
||||||
Hotspots: []p.Hotspot{
|
Hotspots: []p.Hotspot{
|
||||||
{
|
{
|
||||||
Name: "bed",
|
Name: "bed",
|
||||||
|
|||||||
@@ -12,6 +12,28 @@ func defineKitchen(g *p.Game) {
|
|||||||
{CharacterName: "player", At: p.Point{X: 60, Y: 145}},
|
{CharacterName: "player", At: p.Point{X: 60, Y: 145}},
|
||||||
{CharacterName: "cat", At: p.Point{X: 215, Y: 142}},
|
{CharacterName: "cat", At: p.Point{X: 215, Y: 142}},
|
||||||
},
|
},
|
||||||
|
// Floor strip. Same shape as the bedroom — keeps movement on a
|
||||||
|
// consistent Y band and clips destinations away from the cupboard
|
||||||
|
// and coffee machine.
|
||||||
|
Walkboxes: []p.Polygon{
|
||||||
|
p.Poly(
|
||||||
|
p.Point{X: 10, Y: 135},
|
||||||
|
p.Point{X: 310, Y: 135},
|
||||||
|
p.Point{X: 310, Y: 160},
|
||||||
|
p.Point{X: 10, Y: 160},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
// First time the player walks into the kitchen with the key in
|
||||||
|
// hand, drop a hint. The trigger arms on scene enter; the
|
||||||
|
// rising-edge fires once per arming because Once: true.
|
||||||
|
Triggers: []p.Trigger{
|
||||||
|
{
|
||||||
|
Name: "kitchen_with_key_hint",
|
||||||
|
Once: true,
|
||||||
|
When: p.And(p.HasItem("key"), p.Not(p.Flag(FlagCupboardOpen))),
|
||||||
|
Do: p.Say("player", "A kulcs jól jöhet a szekrényhez."),
|
||||||
|
},
|
||||||
|
},
|
||||||
Hotspots: []p.Hotspot{
|
Hotspots: []p.Hotspot{
|
||||||
{
|
{
|
||||||
Name: "cupboard",
|
Name: "cupboard",
|
||||||
|
|||||||
35
domain/widget.savekeys.go
Normal file
35
domain/widget.savekeys.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
|
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
||||||
|
|
||||||
|
p "git.teletypegames.org/games/pncdsl"
|
||||||
|
)
|
||||||
|
|
||||||
|
// saveKeys is a no-draw widget that binds F5 → Save(slot 0) and
|
||||||
|
// F9 → Load(slot 0). Errors are surfaced via FlashLine so the player
|
||||||
|
// sees them in the status strip.
|
||||||
|
type saveKeys struct{}
|
||||||
|
|
||||||
|
func (s *saveKeys) GetName() string { return "save_keys" }
|
||||||
|
|
||||||
|
func (s *saveKeys) Tick(ctx *p.UICtx) {
|
||||||
|
g := ctx.Game
|
||||||
|
if inpututil.IsKeyJustPressed(ebiten.KeyF5) {
|
||||||
|
if err := g.Save(0); err != nil {
|
||||||
|
g.FlashLine("Mentés hiba: " + err.Error())
|
||||||
|
} else {
|
||||||
|
g.FlashLine("Mentve (F5).")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if inpututil.IsKeyJustPressed(ebiten.KeyF9) {
|
||||||
|
if err := g.Load(0); err != nil {
|
||||||
|
g.FlashLine("Töltés hiba: " + err.Error())
|
||||||
|
} else {
|
||||||
|
g.FlashLine("Betöltve (F9).")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *saveKeys) Draw(_ *ebiten.Image, _ *p.UICtx) {}
|
||||||
10
go.mod
10
go.mod
@@ -2,14 +2,20 @@ module git.teletypegames.org/games/pncdsl-demo
|
|||||||
|
|
||||||
go 1.26.3
|
go 1.26.3
|
||||||
|
|
||||||
require git.teletypegames.org/games/pncdsl v0.0.0-00010101000000-000000000000
|
require (
|
||||||
|
git.teletypegames.org/games/pncdsl v0.0.0-00010101000000-000000000000
|
||||||
|
github.com/hajimehoshi/ebiten/v2 v2.9.9
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1 // indirect
|
github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1 // indirect
|
||||||
github.com/ebitengine/hideconsole v1.0.0 // indirect
|
github.com/ebitengine/hideconsole v1.0.0 // indirect
|
||||||
|
github.com/ebitengine/oto/v3 v3.4.0 // indirect
|
||||||
github.com/ebitengine/purego v0.9.0 // indirect
|
github.com/ebitengine/purego v0.9.0 // indirect
|
||||||
github.com/hajimehoshi/ebiten/v2 v2.9.9 // indirect
|
github.com/hajimehoshi/go-mp3 v0.3.4 // indirect
|
||||||
github.com/jezek/xgb v1.1.1 // indirect
|
github.com/jezek/xgb v1.1.1 // indirect
|
||||||
|
github.com/jfreymuth/oggvorbis v1.0.5 // indirect
|
||||||
|
github.com/jfreymuth/vorbis v1.0.2 // indirect
|
||||||
golang.org/x/sync v0.17.0 // indirect
|
golang.org/x/sync v0.17.0 // indirect
|
||||||
golang.org/x/sys v0.36.0 // indirect
|
golang.org/x/sys v0.36.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
10
go.sum
10
go.sum
@@ -2,15 +2,25 @@ github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1 h1:+kz5iTT3L7u
|
|||||||
github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1/go.mod h1:lKJoeixeJwnFmYsBny4vvCJGVFc3aYDalhuDsfZzWHI=
|
github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1/go.mod h1:lKJoeixeJwnFmYsBny4vvCJGVFc3aYDalhuDsfZzWHI=
|
||||||
github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE=
|
github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE=
|
||||||
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
|
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
|
||||||
|
github.com/ebitengine/oto/v3 v3.4.0 h1:br0PgASsEWaoWn38b2Goe7m1GKFYfNgnsjSd5Gg+/bQ=
|
||||||
|
github.com/ebitengine/oto/v3 v3.4.0/go.mod h1:IOleLVD0m+CMak3mRVwsYY8vTctQgOM0iiL6S7Ar7eI=
|
||||||
github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k=
|
github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k=
|
||||||
github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||||
github.com/hajimehoshi/ebiten/v2 v2.9.9 h1:JdDag6Ndj12iD4lxQGG8kbsrh7ssj4Sbzth6r929H/M=
|
github.com/hajimehoshi/ebiten/v2 v2.9.9 h1:JdDag6Ndj12iD4lxQGG8kbsrh7ssj4Sbzth6r929H/M=
|
||||||
github.com/hajimehoshi/ebiten/v2 v2.9.9/go.mod h1:DAt4tnkYYpCvu3x9i1X/nK/vOruNXIlYq/tBXxnhrXM=
|
github.com/hajimehoshi/ebiten/v2 v2.9.9/go.mod h1:DAt4tnkYYpCvu3x9i1X/nK/vOruNXIlYq/tBXxnhrXM=
|
||||||
|
github.com/hajimehoshi/go-mp3 v0.3.4 h1:NUP7pBYH8OguP4diaTZ9wJbUbk3tC0KlfzsEpWmYj68=
|
||||||
|
github.com/hajimehoshi/go-mp3 v0.3.4/go.mod h1:fRtZraRFcWb0pu7ok0LqyFhCUrPeMsGRSVop0eemFmo=
|
||||||
|
github.com/hajimehoshi/oto/v2 v2.3.1/go.mod h1:seWLbgHH7AyUMYKfKYT9pg7PhUu9/SisyJvNTT+ASQo=
|
||||||
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
|
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
|
||||||
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
|
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
|
||||||
|
github.com/jfreymuth/oggvorbis v1.0.5 h1:u+Ck+R0eLSRhgq8WTmffYnrVtSztJcYrl588DM4e3kQ=
|
||||||
|
github.com/jfreymuth/oggvorbis v1.0.5/go.mod h1:1U4pqWmghcoVsCJJ4fRBKv9peUJMBHixthRlBeD6uII=
|
||||||
|
github.com/jfreymuth/vorbis v1.0.2 h1:m1xH6+ZI4thH927pgKD8JOH4eaGRm18rEE9/0WKjvNE=
|
||||||
|
github.com/jfreymuth/vorbis v1.0.2/go.mod h1:DoftRo4AznKnShRl1GxiTFCseHr4zR9BN3TWXyuzrqQ=
|
||||||
golang.org/x/image v0.31.0 h1:mLChjE2MV6g1S7oqbXC0/UcKijjm5fnJLUYKIYrLESA=
|
golang.org/x/image v0.31.0 h1:mLChjE2MV6g1S7oqbXC0/UcKijjm5fnJLUYKIYrLESA=
|
||||||
golang.org/x/image v0.31.0/go.mod h1:R9ec5Lcp96v9FTF+ajwaH3uGxPH4fKfHHAVbUILxghA=
|
golang.org/x/image v0.31.0/go.mod h1:R9ec5Lcp96v9FTF+ajwaH3uGxPH4fKfHHAVbUILxghA=
|
||||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
|
golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
|
|||||||
Reference in New Issue
Block a user