add level skeleton

This commit is contained in:
2023-07-04 22:32:13 +02:00
parent 88cf7620be
commit 93b2725c8a
8 changed files with 130 additions and 12 deletions

View File

@@ -29,6 +29,9 @@ func (e *Engine) Update(screen *ebiten.Image) error {
if e.ScreenTypeIs("dialog") {
e.DialogUpdate()
}
if e.ScreenTypeIs("playground") {
e.PlaygroundUpdate()
}
return nil
}
@@ -39,6 +42,9 @@ func (e *Engine) Draw(screen *ebiten.Image) {
if e.ScreenTypeIs("dialog") {
e.DialogDraw(screen)
}
if e.ScreenTypeIs("playground") {
e.PlaygroundDraw(screen)
}
if e.Controller.Action3Pressed() {
os.Exit(1)
}

View File

@@ -6,5 +6,6 @@ type KContextScreen struct {
}
type KContext struct {
Screen KContextScreen
Screen KContextScreen
CurrentLevel int
}

View File

@@ -15,6 +15,7 @@ type DomainInterface interface {
SetMenu(name string, menu Menu)
GetDialog(name string) Dialog
SetDialog(name string, menu Dialog)
GetLevel(index int) Level
}
type ScreenSettings struct {

View File

@@ -1,12 +1,77 @@
package konstructor
type PlaygroundObject struct {
Image string
PosX int
PosY int
import (
"github.com/hajimehoshi/ebiten"
)
type Position struct {
X int
Y int
Z int
}
type RenderOptions struct {
Image string
Width int
Height int
}
type ObjectType struct {
ID string
RenderOptions RenderOptions
}
type Object struct {
ID string
Type ObjectType
Position Position
}
type NPCType struct {
ID string
RenderOptions RenderOptions
}
type NPC struct {
ID string
Type NPCType
Position Position
}
type Player struct {
ID string
RenderOptions RenderOptions
Position Position
}
type ItemType struct {
ID string
RenderOptions RenderOptions
}
type Item struct {
ID string
Type ItemType
Position Position
}
type Playground struct {
Background string
Objects []PlaygroundObject
Objects []Object
NPCs []NPC
Items []Item
}
type Level struct {
ID string
Name string
Playgrounds []Playground
}
func (e *Engine) PlaygroundDraw(screen *ebiten.Image) {
e.Domain.GetLevel(e.KContext.CurrentLevel)
}
func (e *Engine) PlaygroundUpdate() {
e.Domain.GetLevel(e.KContext.CurrentLevel)
}