From 5d7b8517af0667fade88dbb0c6e36c2d459c5d55 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 3 Dec 2024 00:24:46 -0500 Subject: [PATCH] first playable --- .vs/slots/v17/.suo | Bin 23552 -> 26112 bytes OptionPicker.cs | 40 ++++++++++++ SlotMachine.cs | 60 ++++++++++++++++-- SlotSymbol.cs | 33 +++++++++- Wheel.cs | 6 ++ game.tscn | 46 ++++++++++++-- sprites/{slot-symbol4.png => BAR.png} | Bin ...slot-symbol4.png.import => BAR.png.import} | 6 +- sprites/{slot-symbol3.png => BELL.png} | Bin ...lot-symbol3.png.import => BELL.png.import} | 6 +- sprites/{slot-symbol2.png => CHERRY.png} | Bin ...t-symbol2.png.import => CHERRY.png.import} | 6 +- sprites/{slot-symbol1.png => SEVEN.png} | Bin ...ot-symbol1.png.import => SEVEN.png.import} | 6 +- sprites/SPIN.png | Bin 0 -> 19940 bytes sprites/SPIN.png.import | 34 ++++++++++ sprites/X2.png | Bin 0 -> 10508 bytes sprites/X2.png.import | 34 ++++++++++ 18 files changed, 252 insertions(+), 25 deletions(-) create mode 100644 OptionPicker.cs rename sprites/{slot-symbol4.png => BAR.png} (100%) rename sprites/{slot-symbol4.png.import => BAR.png.import} (71%) rename sprites/{slot-symbol3.png => BELL.png} (100%) rename sprites/{slot-symbol3.png.import => BELL.png.import} (71%) rename sprites/{slot-symbol2.png => CHERRY.png} (100%) rename sprites/{slot-symbol2.png.import => CHERRY.png.import} (71%) rename sprites/{slot-symbol1.png => SEVEN.png} (100%) rename sprites/{slot-symbol1.png.import => SEVEN.png.import} (71%) create mode 100644 sprites/SPIN.png create mode 100644 sprites/SPIN.png.import create mode 100644 sprites/X2.png create mode 100644 sprites/X2.png.import diff --git a/.vs/slots/v17/.suo b/.vs/slots/v17/.suo index dd5717132d9496956442f9ae9385ddf63e6067b0..6c2c8748336ab29355eb972e30a38245c8f90954 100644 GIT binary patch delta 1162 zcmbu8+fNfg6o=>ZMlA(fDHo+cOA~4YY9S<5L@k#JQj|6*SiozkTG6)JHYy^!US53B zrpE^oAsRG3s1a)uMH1uclO~$@928(Yhg0n* zxgPLy&JA-dg;e2(*(hI0*oit~F6CVVNsU?|)lX`SirnwsWH68~lseGR;;hGAng(^% zLNZ~S@%2*DM{FZ}L_aY=3=-Rk9mGyz7qOd=s`<$eWn(E{AV}H)VwgCH`rMwRHU|4J zuH|4aiqr-$p2sQo(ChQ*PkCQtphHo|p|etf$MmC+kD@*UOHf>rLBXQHj|HRnezg%3 zh9Pv8Q*QVQ8WamTScLH+4%8@8n}hLU4peEeI3q)$pSmp@MW>lcmh#YrpGr@ttTdyL zk0ZtrC_&N4K~XwhmJ1uZNSBUCNt~&y@l+ ztgX>b&xz*x4K7E+l&uOMx*LC+=}%uUy!hvDwfUn^*4#Mg4-W+fqX)yW=-@A}|ED{q zX!C1j8fc^CZkXy-;k)h>PI$+$wnnSTq2rP6Xd7*TwFBRFJwSKQt->`V&0Ccq{n!qI z##=?aTzy_ocR6b&p@brJ`bytTSSsDKc{2$X3Zz_1$nm((QrpcUEXIN?%tFjV-cPq8 zz>Y8*MN!s7dW7;2TgUR4207nRbZ!wqg^&A>Llfm?=D$~2FEW)XDZTn@i`xZIn4quByIWnJX26hfN0r(8dVVVKzT z`MG}^FCM;`BoYOemT2<~k2XKNRloTMS7={%7F+JqS3&^@fdejp|rWR<&ve2(;z-Kdf;A} P#?a=m`H*g1s9Ami)47QP diff --git a/OptionPicker.cs b/OptionPicker.cs new file mode 100644 index 0000000..6c4ccc8 --- /dev/null +++ b/OptionPicker.cs @@ -0,0 +1,40 @@ +using Godot; +using System; + +public partial class OptionPicker : Node2D +{ + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + } + + public void Reset() + { + foreach (Node child in GetChildren()) + { + if (child is SlotSymbol slotSymbol) + { + slotSymbol.SetToRandom(); + } + } + } + + public void Show(bool visible) + { + foreach (CanvasItem child in GetChildren()) + { + child.Visible = visible; + } + } + + public SlotSymbol Select(int index) + { + Show(false); + return GetChildren()[index] as SlotSymbol; + } +} diff --git a/SlotMachine.cs b/SlotMachine.cs index 813ffc8..1ac05ce 100644 --- a/SlotMachine.cs +++ b/SlotMachine.cs @@ -2,6 +2,7 @@ using Godot; using Godot.NativeInterop; using System; using System.Collections.Generic; +using System.Numerics; public partial class SlotMachine : Sprite2D { @@ -40,7 +41,9 @@ public partial class SlotMachine : Sprite2D public override void _Ready() { Spins = 7; - } + GetOptionPicker().Show(false); + + } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) @@ -68,22 +71,35 @@ public partial class SlotMachine : Sprite2D List slots = new List(); int points = 0; + bool x2 = false; + foreach (Wheel wheel in Wheels) { SlotSymbol newSlotSymbol = wheel.GetActiveSlotSymbol(); int matches = 0; + foreach (SlotSymbol otherSlot in slots) { - if (otherSlot.SlotType == newSlotSymbol.SlotType) + if (otherSlot.SlotType == newSlotSymbol.SlotType && newSlotSymbol.SlotType != SlotSymbol.Type.SPIN && newSlotSymbol.SlotType != SlotSymbol.Type.X2) { matches++; } + } - if (newSlotSymbol.SlotType == SlotSymbol.Type.SEVEN) - { - points += 7; - } + + if (newSlotSymbol.SlotType == SlotSymbol.Type.SEVEN) + { + points += 7; + } + else if (newSlotSymbol.SlotType == SlotSymbol.Type.SPIN) + { + Spins++; + } + else if (newSlotSymbol.SlotType == SlotSymbol.Type.X2) + { + x2 = true; } + slots.Add(newSlotSymbol); if (matches == 1) { @@ -93,11 +109,22 @@ public partial class SlotMachine : Sprite2D { points += 400; } - + } + + if (x2) + { + points *= 2; } GetNode