From 0c22ecae5e9747ed5233cd2b38ce7e24d124e5d3 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Tue, 2 Jul 2019 15:24:46 -0700 Subject: [PATCH] Level Exit Doodad * Add a Level Exit doodad, which for now is a little blue flag on a pole that reads "END" * JavaScript API: global function EndLevel() will end the level. The exit doodad calls this when touched by the player. * Add a "Level Completed" alert box UI to PlayScene with dynamic button layouts. * The alert box pops up when a doodad calls EndLevel() and contains action buttons what to do next. * "Play Again" restarts the current level again. * "Edit Level" if you came from the EditorScene; otherwise this button is not visible. * "Next Level" is a to-be-implemented button to advance in the single player story mode. Only shows up when PlayScene.HasNext=true. * "Exit to Menu" is always visible and closes out to the MainScene. --- dev-assets/doodads/build.sh | 12 ++ dev-assets/doodads/objects/exit-flag.js | 11 ++ dev-assets/doodads/objects/exit-flag.png | Bin 0 -> 932 bytes pkg/doodle.go | 13 +- pkg/editor_scene.go | 3 +- pkg/editor_ui.go | 1 + pkg/play_scene.go | 156 +++++++++++++++++++++-- pkg/scripting/scripting.go | 4 + pkg/scripting/supervisor_events.go | 23 ++++ 9 files changed, 205 insertions(+), 18 deletions(-) create mode 100644 dev-assets/doodads/objects/exit-flag.js create mode 100644 dev-assets/doodads/objects/exit-flag.png create mode 100644 pkg/scripting/supervisor_events.go diff --git a/dev-assets/doodads/build.sh b/dev-assets/doodads/build.sh index 33dd6ea..5b91a4d 100755 --- a/dev-assets/doodads/build.sh +++ b/dev-assets/doodads/build.sh @@ -86,7 +86,19 @@ azulians() { cd .. } +objects() { + cd objects/ + + doodad convert -t "Exit Flag" exit-flag.png exit-flag.doodad + doodad install-script exit-flag.js exit-flag.doodad + + cp *.doodad ../../../assets/doodads/ + + cd .. +} + buttons doors trapdoors azulians +objects diff --git a/dev-assets/doodads/objects/exit-flag.js b/dev-assets/doodads/objects/exit-flag.js new file mode 100644 index 0000000..056890c --- /dev/null +++ b/dev-assets/doodads/objects/exit-flag.js @@ -0,0 +1,11 @@ +// Exit Flag. +function main() { + console.log("%s initialized!", Self.Doodad.Title); + Self.SetHitbox(22+16, 16, 75-16, 86); + + Events.OnCollide(function(e) { + if (e.InHitbox) { + EndLevel(); + } + }); +} diff --git a/dev-assets/doodads/objects/exit-flag.png b/dev-assets/doodads/objects/exit-flag.png new file mode 100644 index 0000000000000000000000000000000000000000..585152db46014ba1c64abae3b93371250d07273b GIT binary patch literal 932 zcmV;V16%xwP)EX>4Tx04R}tkv&MmP!xqvQ>7vm2P=p;WT*~eK~%(1t5Adrp;lE=7gr}m7b)?+q|hS92bcG8-aCi;?gNB+nQ2zXIH2ja znM%aPOm%zxU_rQF9gp0wVD&GfbO!gLrz= zHaPDSM_5r-iO-40Olpw$k?V@bZ=4G*3p_Jorc?985n{2>#!4HrqNx#25l2-`r+gvf zvC4UivsSLMW}p0p;hes*%yp_EB(R7jND!f*iW17O5u;rv#X^eC<39dD*DsMvAy)~E z91EyGgY5dj|KRs*t^DMKmlTczoiC2_F${!ufkw@7zKZUYzBElt@2E_Z-|Cqp)6R|--I`8@D`M&FbL`fh>lHE(XsbDTZ^X_{5?1~@nb zMhcX@?(^=h_PPCgr#ZhLAXajQK1b?M00006VoOIv00000008+zyMF)x010qNS#tmY zE+YT{E+YYWr9XB6000McNliru;|Bs23@FFIQF;IX02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00DeSL_t(|+U?vyZo)7WMbV#%9hp64P3fA*n&_Z{swoLU z!SoZKH?@+%)z#N?Fz#Ywh9S;N>wOMsHSaxMHWA`#+|Csr#nVigM#_qNi+?mO9hR?1i znazxC&Dgc(-fJJ%=U!|wV_P+LYx}rsd?k|^yBA|;XW&-zp8fpPFOEoTLEMLwLN4pld-MsydLhie)D2%&K;L?1(LHBIJ+e|jdea& zavR&2p^OCOv<$M959erB9KUOaQ0000