- fixed bumpedge test for obstacles
- fixed obstacle crash when going to the south or east
- added wasm builder
This commit is contained in:
2024-03-21 09:38:47 +01:00
parent ae0e3a0676
commit 1d16fcb73f
16 changed files with 712 additions and 148 deletions

View File

@@ -23,6 +23,7 @@ type Level struct {
World *ecs.World
Name string
Description string
Number int
Mapslice Map
BackupMapslice Map
GridContainer *grid.GridContainer
@@ -65,6 +66,7 @@ func NewLevel(game *Game, cellsize int, plan *ldtkgo.Level) *Level {
Width: game.ScreenWidth,
Height: game.ScreenHeight,
Description: plan.PropertyByIdentifier("description").AsString(),
Number: plan.PropertyByIdentifier("level").AsInt(),
Name: strings.ReplaceAll(plan.Identifier, "_", " "),
GridContainer: gridcontainer,
Systems: systemlist,

View File

@@ -88,10 +88,10 @@ func (scene *PopupScene) SetupUI() {
scene.SetNext(Menu)
})
buttonOptions := gameui.NewMenuButton("Options", *assets.FontRenderer.FontNormal,
func(args *widget.ButtonClickedEventArgs) {
scene.SetNext(Settings)
})
// buttonOptions := gameui.NewMenuButton("Options", *assets.FontRenderer.FontNormal,
// func(args *widget.ButtonClickedEventArgs) {
// scene.SetNext(Settings)
// })
label := widget.NewText(
widget.TextOpts.Text("Menu", *assets.FontRenderer.FontBig, blue),
@@ -101,7 +101,7 @@ func (scene *PopupScene) SetupUI() {
rowContainer.AddChild(label)
rowContainer.AddChild(buttonContinue)
rowContainer.AddChild(buttonAbort)
rowContainer.AddChild(buttonOptions)
//rowContainer.AddChild(buttonOptions)
scene.Ui = &ebitenui.UI{
Container: rowContainer.Container(),

View File

@@ -67,8 +67,9 @@ func (scene *SelectScene) Draw(screen *ebiten.Image) {
}
type LevelEntry struct {
Id int
Name string
Id int
Number int
Name string
}
func (scene *SelectScene) SetupUI() {
@@ -85,7 +86,7 @@ func (scene *SelectScene) SetupUI() {
levels := make([]any, 0, len(scene.Game.Levels))
for id := 0; id < len(scene.Game.Levels); id++ {
levels = append(levels, LevelEntry{Id: id, Name: scene.Game.Levels[id].Name})
levels = append(levels, LevelEntry{Id: id, Number: scene.Game.Levels[id].Number, Name: scene.Game.Levels[id].Name})
}
slog.Debug("levels", "levels", levels)
@@ -140,7 +141,7 @@ func (scene *SelectScene) SetupUI() {
}),
// This required function returns the string displayed in the list
widget.ListOpts.EntryLabelFunc(func(e interface{}) string {
return fmt.Sprintf("%02d %s", e.(LevelEntry).Id, e.(LevelEntry).Name)
return fmt.Sprintf("%02d %s", e.(LevelEntry).Number, e.(LevelEntry).Name)
}),
// Padding for each entry
widget.ListOpts.EntryTextPadding(widget.NewInsetsSimple(5)),