From 9babdef47fb1dda1c989aa1b1c545744ff69ef54 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Thu, 14 Mar 2024 23:48:54 +0800 Subject: [PATCH 1/3] spx v1.0.0 --- .gitignore | 5 +- {res => assets}/1.jpg | Bin {res => assets}/img/backdrop1.png | Bin {res => assets}/img/costume1.png | Bin {res => assets}/img/m.png | Bin {res => assets}/img/niu.png | Bin {res => assets}/index.json | 0 {res => assets}/sounds/mhit/index.json | 0 {res => assets}/sounds/mhit/sfx_hit.wav | Bin {res => assets}/sprites/Calf/index.json | 0 {res => assets}/sprites/Maze/index.json | 0 {res => assets}/sprites/Red/index.json | 0 dummy/dummy.go | 6 -- go.mod | 5 +- go.sum | 3 - gop_autogen.go | 99 ++++++++++++++++++++++++ index.gmx => main.spx | 2 - run.sh | 4 +- 18 files changed, 103 insertions(+), 21 deletions(-) rename {res => assets}/1.jpg (100%) rename {res => assets}/img/backdrop1.png (100%) rename {res => assets}/img/costume1.png (100%) rename {res => assets}/img/m.png (100%) rename {res => assets}/img/niu.png (100%) rename {res => assets}/index.json (100%) rename {res => assets}/sounds/mhit/index.json (100%) rename {res => assets}/sounds/mhit/sfx_hit.wav (100%) rename {res => assets}/sprites/Calf/index.json (100%) rename {res => assets}/sprites/Maze/index.json (100%) rename {res => assets}/sprites/Red/index.json (100%) delete mode 100644 dummy/dummy.go create mode 100644 gop_autogen.go rename index.gmx => main.spx (55%) diff --git a/.gitignore b/.gitignore index f233c33..8abd547 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -gop_autogen*.go -gop.mod .gop/ .DS_Store @@ -18,4 +16,5 @@ gop.mod # Dependency directories (remove the comment below to include it) # vendor/ -gop_autogen.go +MazePlay* +go.work* diff --git a/res/1.jpg b/assets/1.jpg similarity index 100% rename from res/1.jpg rename to assets/1.jpg diff --git a/res/img/backdrop1.png b/assets/img/backdrop1.png similarity index 100% rename from res/img/backdrop1.png rename to assets/img/backdrop1.png diff --git a/res/img/costume1.png b/assets/img/costume1.png similarity index 100% rename from res/img/costume1.png rename to assets/img/costume1.png diff --git a/res/img/m.png b/assets/img/m.png similarity index 100% rename from res/img/m.png rename to assets/img/m.png diff --git a/res/img/niu.png b/assets/img/niu.png similarity index 100% rename from res/img/niu.png rename to assets/img/niu.png diff --git a/res/index.json b/assets/index.json similarity index 100% rename from res/index.json rename to assets/index.json diff --git a/res/sounds/mhit/index.json b/assets/sounds/mhit/index.json similarity index 100% rename from res/sounds/mhit/index.json rename to assets/sounds/mhit/index.json diff --git a/res/sounds/mhit/sfx_hit.wav b/assets/sounds/mhit/sfx_hit.wav similarity index 100% rename from res/sounds/mhit/sfx_hit.wav rename to assets/sounds/mhit/sfx_hit.wav diff --git a/res/sprites/Calf/index.json b/assets/sprites/Calf/index.json similarity index 100% rename from res/sprites/Calf/index.json rename to assets/sprites/Calf/index.json diff --git a/res/sprites/Maze/index.json b/assets/sprites/Maze/index.json similarity index 100% rename from res/sprites/Maze/index.json rename to assets/sprites/Maze/index.json diff --git a/res/sprites/Red/index.json b/assets/sprites/Red/index.json similarity index 100% rename from res/sprites/Red/index.json rename to assets/sprites/Red/index.json diff --git a/dummy/dummy.go b/dummy/dummy.go deleted file mode 100644 index e19357e..0000000 --- a/dummy/dummy.go +++ /dev/null @@ -1,6 +0,0 @@ -package dummy - -import ( - _ "github.com/goplus/gop" - _ "github.com/goplus/spx" -) diff --git a/go.mod b/go.mod index b4e1232..5dddd9e 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,7 @@ module github.com/goplus/MazePlay go 1.16 -require ( - github.com/goplus/gop v1.0.36 - github.com/goplus/spx v1.0.0 -) +require github.com/goplus/spx v1.0.0 replace ( github.com/hajimehoshi/oto => github.com/hajimehoshi/oto v1.0.1 diff --git a/go.sum b/go.sum index 66defeb..92831cb 100644 --- a/go.sum +++ b/go.sum @@ -14,9 +14,6 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF0 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/goplus/canvas v0.1.0 h1:Vx3f2+U8UANvWf5/01YsQYKNbZDm1GZCjhlEBFrQkeU= github.com/goplus/canvas v0.1.0/go.mod h1:Rhcvo5qkpD9WuXFnvnXtrBSY97l6h7sXQuofrmiLNdM= -github.com/goplus/gop v1.0.36 h1:XpqEwxdgbav87RoUh+goEl21UlLT4ETyw4L4Zvf1msM= -github.com/goplus/gop v1.0.36/go.mod h1:JMjZXjcfATZdT+1SIU4bXpaXJIvs6xTNVzjI8+XQhRM= -github.com/goplus/gox v1.8.7/go.mod h1:XWqV75HImeysI8+Q9gAdYyvwlP8jds24xsgYRwTO3JI= github.com/goplus/spx v1.0.0 h1:mEPqYCjYfWmRNkyq0VMDlD3XtkldDlbzCO69d/iAYro= github.com/goplus/spx v1.0.0/go.mod h1:/k34E8W0YobBjsjvpefJz6n1SLMgAyHIuGb1BBRwtDk= github.com/hajimehoshi/bitmapfont/v2 v2.2.0/go.mod h1:Llj2wTYXMuCTJEw2ATNIO6HbFPOoBYPs08qLdFAxOsQ= diff --git a/gop_autogen.go b/gop_autogen.go new file mode 100644 index 0000000..cbc5ce5 --- /dev/null +++ b/gop_autogen.go @@ -0,0 +1,99 @@ +// Code generated by gop (Go+); DO NOT EDIT. + +package main + +import "github.com/goplus/spx" + +const _ = true + +type Calf struct { + spx.Sprite + *Game +} +type Maze struct { + spx.Sprite + *Game +} +type Red struct { + spx.Sprite + *Game +} +type Game struct { + spx.Game + Calf Calf + Maze Maze + Red Red + mhit spx.Sound +} + +func (this *Game) MainEntry() { +} +func (this *Game) Main() { + spx.Gopt_Game_Main(this, new(Calf), new(Maze), new(Red)) +} +//line Calf.spx:1 +func (this *Calf) Main() { +//line Calf.spx:1:1 + this.OnStart(func() { +//line Calf.spx:2:1 + this.SetXYpos(-204, 145) +//line Calf.spx:3:1 + for { + spx.Sched() +//line Calf.spx:4:1 + if this.Touching("Maze") { +//line Calf.spx:5:1 + this.Play__0(this.mhit) +//line Calf.spx:6:1 + this.SetXYpos(-204, 145) + } +//line Calf.spx:8:1 + if this.Touching("Red") { +//line Calf.spx:9:1 + this.Say("You win") +//line Calf.spx:10:1 + this.Wait(3) +//line Calf.spx:11:1 + spx.Exit__0(-1) + } +//line Calf.spx:13:1 + this.Wait(0.03) + } + }) +//line Calf.spx:17:1 + this.OnKey__0(spx.KeyUp, func() { +//line Calf.spx:18:1 + this.ChangeYpos(3) + }) +//line Calf.spx:21:1 + this.OnKey__0(spx.KeyDown, func() { +//line Calf.spx:22:1 + this.ChangeYpos(-3) + }) +//line Calf.spx:25:1 + this.OnKey__0(spx.KeyLeft, func() { +//line Calf.spx:26:1 + this.ChangeXpos(-3) + }) +//line Calf.spx:29:1 + this.OnKey__0(spx.KeyRight, func() { +//line Calf.spx:30:1 + this.ChangeXpos(3) + }) +} +func (this *Calf) Classfname() string { + return "Calf" +} +func (this *Maze) Classfname() string { + return "Maze" +} +func (this *Maze) Main() { +} +func (this *Red) Classfname() string { + return "Red" +} +func (this *Red) Main() { +} +func main() { + new(Game).Main() +} diff --git a/index.gmx b/main.spx similarity index 55% rename from index.gmx rename to main.spx index 8b19e73..bb74d92 100644 --- a/index.gmx +++ b/main.spx @@ -4,5 +4,3 @@ var ( Red Red mhit Sound ) - -run "res", {Title: "MazePlay (by Go+)"} diff --git a/run.sh b/run.sh index 8dd2081..de98679 100755 --- a/run.sh +++ b/run.sh @@ -1,3 +1 @@ -go mod tidy -rm -f .gop/gop.cache -gop run . -f +gop run . From 4d68fb65b3a475245c738e242aa10382761268ae Mon Sep 17 00:00:00 2001 From: xushiwei Date: Thu, 14 Mar 2024 23:49:52 +0800 Subject: [PATCH 2/3] go1.18 --- go.mod | 26 +++++++++++++++++++++++++- go.sum | 1 - 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 5dddd9e..114fee2 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,33 @@ module github.com/goplus/MazePlay -go 1.16 +go 1.18 require github.com/goplus/spx v1.0.0 +require ( + github.com/ajstarks/svgo v0.0.0-20210927141636-6d70534b1098 // indirect + github.com/esimov/stackblur-go v1.0.1-0.20190121110005-00e727e3c7a9 // indirect + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220320163800-277f93cfa958 // indirect + github.com/gofrs/flock v0.8.1 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/goplus/canvas v0.1.0 // indirect + github.com/hajimehoshi/ebiten/v2 v2.3.4 // indirect + github.com/hajimehoshi/go-mp3 v0.3.3 // indirect + github.com/hajimehoshi/oto/v2 v2.1.0 // indirect + github.com/jezek/xgb v1.0.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/qiniu/audio v0.2.1 // indirect + github.com/qiniu/x v1.13.9 // indirect + github.com/srwiley/oksvg v0.0.0-20210519022825-9fc0c575d5fe // indirect + github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 // indirect + golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect + golang.org/x/image v0.0.0-20220321031419-a8550c1d254a // indirect + golang.org/x/mobile v0.0.0-20220518205345-8578da9835fd // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f // indirect + golang.org/x/text v0.3.7 // indirect +) + replace ( github.com/hajimehoshi/oto => github.com/hajimehoshi/oto v1.0.1 github.com/srwiley/oksvg => github.com/qiniu/oksvg v0.2.0-no-charset diff --git a/go.sum b/go.sum index 92831cb..a08a2bc 100644 --- a/go.sum +++ b/go.sum @@ -23,7 +23,6 @@ github.com/hajimehoshi/file2byteslice v0.0.0-20210813153925-5340248a8f41/go.mod github.com/hajimehoshi/go-mp3 v0.3.2/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= github.com/hajimehoshi/go-mp3 v0.3.3 h1:cWnfRdpye2m9ElSoVqneYRcpt/l3ijttgjMeQh+r+FE= github.com/hajimehoshi/go-mp3 v0.3.3/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= -github.com/hajimehoshi/oto v1.0.1 h1:8AMnq0Yr2YmzaiqTg/k1Yzd6IygUGk2we9nmjgbgPn4= github.com/hajimehoshi/oto v1.0.1/go.mod h1:wovJ8WWMfFKvP587mhHgot/MBr4DnNy9m6EepeVGnos= github.com/hajimehoshi/oto/v2 v2.1.0 h1:/h+UkbKzhD7xBHOQlWgKUplBPZ+J4DK3P2Y7g2UF1X4= github.com/hajimehoshi/oto/v2 v2.1.0/go.mod h1:9i0oYbpJ8BhVGkXDKdXKfFthX1JUNfXjeTp944W8TGM= From 97572764d8aee205d77995ff6bbc3283bc029f77 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Thu, 14 Mar 2024 23:53:06 +0800 Subject: [PATCH 3/3] README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0006c05..fd395c2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -MazePlay - a game powered by Go+ spx game engine +MazePlay - powered by Go+ Builder ========= [![Language](https://img.shields.io/badge/language-Go+-blue.svg)](https://github.com/goplus/gop) @@ -9,8 +9,8 @@ MazePlay - a game powered by Go+ spx game engine ### How to run -- Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. +- Install Go+. See https://github.com/goplus/gop#how-to-install. - Download this game and run. * git clone https://github.com/goplus/MazePlay.git * cd MazePlay - * ./run.sh + * gop run .