From 517eef4c3f641d6e4fa1aeaf0a8c6fea9acf1557 Mon Sep 17 00:00:00 2001 From: Joalor64 Date: Sat, 29 Jun 2024 22:10:25 -0400 Subject: [PATCH] augh --- assets/images/icons/mgicons/card.png | Bin 0 -> 2387 bytes assets/images/minigames/cards.png | Bin 0 -> 2952 bytes source/meta/state/MinigamesState.hx | 8 +- source/minigames/FunkyMemory.hx | 134 +++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 assets/images/icons/mgicons/card.png create mode 100644 assets/images/minigames/cards.png create mode 100644 source/minigames/FunkyMemory.hx diff --git a/assets/images/icons/mgicons/card.png b/assets/images/icons/mgicons/card.png new file mode 100644 index 0000000000000000000000000000000000000000..2f51cecfab08aaec26b6baf6c19a3e7dc1c0e918 GIT binary patch literal 2387 zcmaJ@dpOf=A0JtURV!K4Mo-CVTL?XtLm|VW;8Pd-_QO1{Bd8`9eete?Iz`&${-ME z6T!~fS+=MCT96I0s4^Db3j)cJPCK~bWykgPby@uXu(Gm>jErn=Z~tGhsi~>Gy?sSR zg^Zk>oSdJZ|0i|j$`u(iFfg#Tw)PKWXlO{GP%d1!keHa5m6avS_V@RXkB`sH%*YCi zjErPgD=8@{D=R~xP#6rRs;atU#}0LMbp!%|L?SU5jGmsJzP`Rp2ZzI%nVFfJn;$)T z)Y8(DKp;3eIueOQ5{U!=fV;apl}e@4=}acm$H(W|wQB(Z0l~q+p`oD>5fRbR(J?VG z@$vDpF_My!l9Q9Ov$G#PdX$@+o1dT0<#G!P3;BG$Kp?2BtgNZ2sjaPj_Uu`GeSKqN zV@pemY;2K8)YH==8-8SDWOQ_NY-~*CVrpt?dU{$amCnu0EiEm5|NdQO%8T*b!}s?LdlAPK9$=+SH+6Bu8gfb;keFC2b`$_Qz9q{xvu7>~ z$w!2Ki}1Sw13foTftt8^v(m>=i|2*_lbm>$EiK#z?SF zwMwcIkpIWRfyaIV5*mK~E_>Zd$bB46%Xf!UC~%IF7K!cFqzGm;F^Re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 literal 0 HcmV?d00001 diff --git a/assets/images/minigames/cards.png b/assets/images/minigames/cards.png new file mode 100644 index 0000000000000000000000000000000000000000..ecb3a380a149c4c57e155767648e79d61597d392 GIT binary patch literal 2952 zcmd^Bdpy&7AD>GXxyFeKDWVhMIFwsVqLpMt%&}<>CAp25CB}MA=R`Dhq`4ewDKSH8 z=9ZC++(~Yk5oR=|J#))#XJ0*kKYu;XKhN{e@B91Q-kkcw6}Mjxb@t=$jkVlPRp-_ zhFy{&e=OYW~dNcWj7EA5Xu-O$H>QXAHJx3@(@H{sIpO zkS*B=?^D_9CHRvAL}>K}k$T9CR>)odi6LH3%vfTHe_7i$)#+undZyfA)x?NuF9ie*?-`> zsQjN7$%-1IcMkbf7+CJ#hx~tvy$%Ee)uhrG3_N(S zN2QZ*siCg$gI@$X=#A%8LJgBXpjKpZcxCKio{mXwCDgxMzVT3%*En@r#rIQ#p!n$xpM=#W^;(3_Py$6(wpL$^DeIIXEHRmJ1G zOvVfP$4E)S@Wq1Rch_sdzJ(ok-#O}pFsxbd~1T~I0PcpoYa9IysL2x*~k z)QLgEJH_5?_AxUzze)!j2rCbx2?pPq>wQr#$!p`>Nri?F^xsT^KKewKbA4a#E`43H zo2L-ffR;_wk6U905SxzGDytc$y9p`*@YgtscAa6ix%FhofNEB*Fg@OQOF1%6Gg-F! zPy_XF>eI4?fs#i^%gAZoT*@{PLzl7k<>Pyp+n_ohUtn(J6{gJtEJkbG9SH`Nm*i-SbwL!Sp>u=|$GA&-utnTUUQ$?e!ppWLFb^Jx8=c8^{*Wv-ehOS^p1$}8?3kN{%FRzJ%?GDNEFyDAep0=ZRJFVg1E;TXw?q6)jQ0mLBC| z!1l?7UT=Z{UQjO|B-#U=&APB?*_w%KYEE^5SAaX8aLOGaQ9MuYDb&Ir*f(PgWu&oU z-Yz>N0nmU*tjZ{R%2G*fJroms#ADIpgVwp>ox|R;Dn*h2yt~(tusZvPVfgf<%!8B` z26O(?B4WHMB>@A%pSksjp`$V8>;8VMC?9_&H;z7AR_pe@GdR2s2q!!%UlVJWe&LjfZYd< zs*O68#I9mu3ulCEt6bGWGsy|VKw~hn@vzQS{xZe*VtQSWL#%cy6n?7$9J*b4kBC5 zn@aGxFg+5M#WAcNn{ngnUILd4gj0|RA$4;7(8>C|0i+uC;J?&`i4gPqT1Qp~eo56| zeF`Qrpjh> zLEEa?;X!B`^Ye1!Kz4ZRme;=G3(It9b9Bvlh%0Wys*lm7Oz*^5P3PAxz#^zt7CL-S zb0v6onT={^hUGt{0Hx90Vs18TZ9)vQe2J8jXR$PGB3OBNvfDDMZTk_>Cc+Y8L8936 zNaImtV;Vm8aQ*tIfaJ@0jNJc8;>+hn1CVL>7k(Mcxr zTG%dC&`-WT`?ZRS+(q-CnEVKLbUsmT0zUQTZM_f8L(~IuJ?U`AlfMLGtjR(zBxR!j zB)+(pSMWx|8S_bhlYMZ>i ziFu{5mbwp{VDY6&m8c#8(dNZ9461T@{z3ZY3}|v!kthxtTONqq=*Sc11jh;0T}E1& z?J;8y&R#v`))Q{636dlyWNr`B75e9Blsx_`1!f+6Zxtuk_;|(24@ZOH_+coMoAD^q za#Ph#OG91;i1->Gs8^RpqtP06C2Lf7Kh4)@0Y&O+P=lhAU|9*EJJovvZ z&fk(k@yR)#2f*e)u+0XeVEr#X_P#$OpGZ(WOSQ$XQyw&=oOxvr=h=Rc_l%>9L$STj GKmG = [ new Minigame('GET OUT OF MY HEAD', 'the pain never stops\n(Amogus)', 'mgicons/sus'), new Minigame('.jpegs are funny', "they are and you can't tell me otherwise\n(Compression)", 'mgicons/pico'), - new Minigame('Kill BF', 'lmao\n(Point & Click)', 'mgicons/killBf') + new Minigame('Kill BF', 'lmao\n(Point & Click)', 'mgicons/killBf'), + new Minigame('Funky Memory', 'Do you remember?\n(Point & Click)', 'mgicons/card') // soon... - // new Minigame('Funky Memory', 'Do you remember?\n(Point & Click)', 'mgicons/card') // new Minigame("Joalor64's Special", 'It\'s me!\n(Melodic Circuit)', 'mgicons/me') ]; @@ -88,8 +88,8 @@ class MinigamesState extends MusicBeatState LoadingState.loadAndSwitchState(new PlayState()); case 2: MusicBeatState.switchState(new minigames.KillBF()); - /* case 3: - MusicBeatState.switchState(new minigames.CardGame()); */ + case 3: + MusicBeatState.switchState(new minigames.FunkyMemory()); } } } diff --git a/source/minigames/FunkyMemory.hx b/source/minigames/FunkyMemory.hx new file mode 100644 index 00000000..83222481 --- /dev/null +++ b/source/minigames/FunkyMemory.hx @@ -0,0 +1,134 @@ +package minigames; + +import minigames.Card; +import minigames.C; + +#if (flixel >= "5.0.0") +import flixel.input.mouse.FlxMouseEvent; +#end + +class FunkyMemory extends MusicBeatState +{ + static inline final READY = "Ready to play"; + + private var NUMBER_OF_CARDS:Int = 24; + private var CARDS_PER_ROW:Int = 8; + private var cards:Array = new Array(); + private var card:Card; + private var pickedCards:Array = new Array(); + private var canPick:Bool = true; + private var matchesFound = 0; + private var canResetGame = false; + private var statusText:FlxText; + + override public function create() + { + super.create(); + + FlxG.sound.playMusic(Paths.music('breakfast')); + + for (i in 0...NUMBER_OF_CARDS) + { + cards.push(Math.floor(i / 2) + 1); + } + trace("My cards: " + cards); + + var i:Int = NUMBER_OF_CARDS; + var swap:Int, tmp:Int; + while (i-- > 0) + { + swap = Math.floor(Math.random() * i); + tmp = cards[i]; + cards[i] = cards[swap]; + cards[swap] = tmp; + } + trace("My shuffled cards: " + cards); + + for (i in 0...NUMBER_OF_CARDS) + { + card = new Card(cards[i]); + add(card); + var hm:Float = (FlxG.width - card.width * CARDS_PER_ROW - 10 * (CARDS_PER_ROW - 1)) / 2; + var vm:Float = (FlxG.height - card.height * (NUMBER_OF_CARDS / CARDS_PER_ROW) - 10 * (NUMBER_OF_CARDS / CARDS_PER_ROW)) / 2; + card.x = hm + (card.width + 10) * (i % CARDS_PER_ROW); + card.y = vm + (card.height + 10) * (Math.floor(i / CARDS_PER_ROW)); + + // update your fucking flixel + #if (flixel >= "5.0.0") + FlxMouseEvent.add(card, onMouseDown); + #end + } + + statusText = new FlxText(0, FlxG.height - 50, FlxG.height, READY, 20); + statusText.setFormat(Paths.font('vcr.ttf'), 30, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); + statusText.screenCenter(X); + add(statusText); + } + + override public function update(elapsed:Float) + { + super.update(elapsed); + + if (((FlxG.mouse.justPressed) && (canResetGame)) || (controls.RESET)) + { + MusicBeatState.resetState(); + } + + if (controls.BACK) + { + MusicBeatState.switchState(new MinigamesState()); + FlxG.sound.playMusic(Paths.music('freakyMenu')); + } + } + + private function onMouseDown(picked:Card) + { + statusText.text = "You picked a " + C.color[picked.index] + " card"; + + if (canPick) + { + if (pickedCards.indexOf(picked) == -1) + { + pickedCards.push(picked); + picked.flip(); + } + + if (pickedCards.length == 2) + { + canPick = false; + if (pickedCards[0].index == pickedCards[1].index) + { + statusText.text = "Cards match!!!!"; + FlxMouseEvent.remove(pickedCards[0]); + FlxMouseEvent.remove(pickedCards[1]); + canPick = true; + matchesFound++; + pickedCards = new Array(); + if (matchesFound == NUMBER_OF_CARDS / 2) + { + FlxG.sound.play(Paths.sound('confirmMenu')); + statusText.text = "You won! Click anywhere to play again!"; + Timer.delay(function() + { + canResetGame = true; + }, 1000); + } + } + else + { + FlxG.sound.play(Paths.sound('cancelMenu')); + statusText.text = "Cards do not match"; + + Timer.delay(function() + { + pickedCards[0].flipBack(); + pickedCards[1].flipBack(); + pickedCards = new Array(); + canPick = true; + statusText.text = READY; + }, 1000); + } + } + } + } +} \ No newline at end of file