'Paw Patrol matching\memory game
'8/27/2021
'UniKorn ProDucKions
'inital test release V1b(eta)
'9/2/2021:Release-002
'To Be Finished;
'Game Mode 2-Pup to Badge matching
'High Score addition;
'À-Name Entry and Hi-lite
'Add and exit button to Options Screen and High Scores(just hit ESC for now)
GameType
AS _BYTE 'Mode 1(P+P,B+B) or Mode 2(P+B) Status
AS _BYTE 'MainMenu or GameMode Match
AS INTEGER 'number of matches made in game Level
AS SINGLE '"difficulty" of game 1-12cards, 2-24cards,3-48cards,4-70cards Quit
AS SINGLE 'player quits current game :(
Flipped
AS _BYTE 'is card flipped?(displayed) Matched
AS _BYTE 'is the card still here?
'------------------------Constants-------------------------
CONST MainMenu
= 1, Options
= 2, Help
= 3, GameMode
= 4, HighScores
= 5 CONST Mode_1
= 1, Mode_2
= 2 CONST Level_1
= 1, Level_2
= 1.5, Level_3
= 2, Level_4
= 2.5 '----------------------------------------------------------
'----------------------Tile Data---------------------------
Card_data: '10 tiles
DATA 32,165,190,323:
'sky DATA 207,341,365,499:
'chase DATA 31,517,189,675:
'everest DATA 383,343,541,501:
'marshal DATA 30,868,188,1026:
'rubble DATA 32,340,190,498:
'marshal badge DATA 30,692,188,850:
'chase badge DATA 206,693,364,851:
'rubble badge DATA 206,869,364,1027:
'sky badge DATA 208,166,366,324:
'everest badge 'perhaps more tiles would be nice?
Board_Size:
'----------------------------------------------------------
'---------------------Array and Globals--------------------
'----------------------------------------------------------
'------------------------Timers----------------------------
ON TIMER(T&
, .5) BackGroundMusic
'control the background music ON TIMER(M&
, 1) CountTime
'keeps track of time during gameplay '----------------------------------------------------------
G.Status = MainMenu
G.BGMVol = 45
G.SFXVol = 45
MFI_Loader "PawsV1b.mfi"
SetVolumes 'adjust volume levels
_DELAY 5 'leave the pups up for a few seconds.
'--------------------------GFX setup stuff------------------------
'-----------------------------------------------------------------
'-----------------------------Load Data---------------------------
READ Cards
(i%%
).X1
, Cards
(i%%
).Y1
, Cards
(i%%
).X2
, Cards
(i%%
).Y2
'-----------------------------------------------------------------
Build_Screens MainMenu
_SOURCE Layer
(7) 'click check layer COLOR _RGB32(255, 255, 0) 'mouse over menu options highlight color Create_ClickMap MainMenu
Fade_In Layer(8)
G.Level = Level_1
_PUTIMAGE , Layer
(8), Layer
(1) 'prep the menu layer to screen(erases old screen cycle)
Opt%% = Mouse_Over
ButtonDown%% = TRUE
Clicked%% = TRUE
ButtonDown%% = FALSE
'check over game options with click layer
CASE 1 ' Game mode 1, Portrat+Portrat CASE 2 ' Game Mode 2, Portrat+Badge CASE 4 ' High Scores(most matches in a row? Board completion time?) CASE 5 ' Options (Sound levels, High Score Reset) CASE 6 ' Quit the game(Tis a sad day indeed!) IF Clicked%%
AND ButtonDown%%
= FALSE
THEN 'user clicked something lets see what. G.Level = Level_1
G.Status = GameMode
Game_Mode1
IF G.Level
= 3 THEN 'victory screen Run_Victory
Create_ClickMap MainMenu
G.Status = MainMenu
Fade_Out Layer(0)
Build_Screens Help
Build_Screens MainMenu
Fade_In Layer(8)
Fade_Out Layer(0)
Build_Screens HighScores
Build_Screens MainMenu
Fade_In Layer(8)
Fade_Out Layer(0)
Build_Screens Options 'Build Options
Create_ClickMap Options
Fade_In Layer(8)
Options_Menu
Fade_Out Layer(0)
Build_Screens MainMenu 'rebuild MainMenu
Create_ClickMap MainMenu
Fade_In Layer(8)
QuitFlag%% = TRUE
Opt%% = 0
Clicked%% = FALSE
' BackGroundMusic 'deal with the menus background music || Handled with Timer for now
'debugging information area
' LINE (600, 500)-STEP(160, 99), _RGB32(0), BF
' _PRINTSTRING (600, 500), STR$(LastPlay!), Layer(1)
' _PRINTSTRING (600, 524), STR$(Clicked%%), Layer(1)
' _PRINTSTRING (600, 548), STR$(ButtonDown%%), Layer(1)
' _PRINTSTRING (600, 572), STR$(Opt%%), Layer(1)
'Fade_Out _DISPLAY
'SND_FadeOut
'shut down audio
'C%% = (800 - (740 - 14)) \ 2
'_PUTIMAGE (C%%, 0), Layer(2), _DISPLAY, (14, 11)-(740, 149) 'Game Menu Title
SUB Create_ClickMap
(Opt%%
) 'the actual game mode is unimportant, just the number of cards to layout.
Offset% = 175 / G.Level
Scaled% = 157 / G.Level
FOR y%%
= 0 TO BoardY
(G.Level
* 2 - 1) FOR x%%
= 0 TO BoardX
(G.Level
* 2 - 1) C%% = C%% + 1
LINE (50 + x%%
* Offset%
, 75 + y%%
* Offset%
)-STEP(Scaled%
, Scaled%
), _RGB32(64, 64, C%%
), BF
Result~%% = 0 'just in case?
Mouse_Over = Result~%%
SUB Build_Screens
(Opt%%
) ClearLayer Layer(8)
Cx% = (800 - 464) \ 2 'Center the image on screen
Cy% = (600 - 396) \ 2
_PUTIMAGE (Cx%
, Cy%
), Layer
(4), Layer
(8) 'Title Screen Logo background Cx% = (800 - 464) \ 2 'Center the image on screen
Cy% = (600 - 396) \ 2
_PUTIMAGE (Cx%
, Cy%
), Layer
(4), Layer
(8) 'Title Screen Logo background _PRINTSTRING (400 - 144, 350), "Reset High Scores", Layer
(8) ClearLayer Layer(9)
_PRINTSTRING (16, 32), "In game mode one(1) the goal is to match", Layer
(9) _PRINTSTRING (16, 64), "Pup to Pup and Badge to Badge. Beat all 4", Layer
(9) _PRINTSTRING (16, 96), "levels quickly for high scores!", Layer
(9) _PRINTSTRING (16, 144), "In game mode two(2) the goal is to match", Layer
(9) _PRINTSTRING (16, 176), "Pup to badge. Make as many matches as", Layer
(9) _PRINTSTRING (16, 208), "possible in 120 seconds for high scores!", Layer
(9) _PRINTSTRING (16, 256), "Make matches by clicking on the back of", Layer
(9) _PRINTSTRING (16, 288), "the cards to reveal a pup or badge image.", Layer
(9) _PRINTSTRING (16, 320), "Depending on game mode they matched by", Layer
(9) _PRINTSTRING (16, 352), "Pup to Pup\Badge to Badge, or", Layer
(9) _PRINTSTRING (16, 384), "in game mode 2 Pup to Badge.", Layer
(9) Fade_In Layer(9)
Fade_Out Layer(0)
ClearLayer Layer(9)
'Game time high scores (time to finish matches)
'Matches under timer (matches made in 120 sec
Fade_In Layer(9)
Fade_Out Layer(0)
_PUTIMAGE , Layer
(8), Layer
(1) 'prep the menu layer to screen(erases old screen cycle) BGMV = G.BGMVol / 100: SFXV = G.SFXVol / 100
Opt%% = Mouse_Over
ButtonDown%% = TRUE
Clicked%% = TRUE
ButtonDown%% = FALSE
'check over game options with click layer
CASE 1 'Music Vol controller CASE 2 ' Sounds Vol Controller CASE 3 ' Reset High Scores List _PRINTSTRING (400 - 144, 350), "Reset High Scores", Layer
(1)
IF (Clicked%%
AND ButtonDown%%
= FALSE
) AND Opt%%
> 2 THEN 'user clicked something lets see what. CASE 3 'Reset High Scores ExitFlag%% = TRUE
Opt%% = 0
Clicked%% = FALSE
ELSEIF ButtonDown%%
THEN 'the volume controls are button down and slide ELSEIF Clicked%%
THEN 'once released change volume levels Clicked%% = FALSE
SetVolumes
' BackGroundMusic 'deal with the menus background music || Handled with Timer for now
'main theme is still playing so nothing to do!
IF LastPlay&
> 86350 THEN LastPlay&
= 0 'make the midnight jump (what are little kids doing up?)
'-----------------------------Looping Music Section----------------------------------------
ELSEIF G.Status
= MainMenu
THEN 'user is in the menus
'================================Menu Music Area===========================================
IF LastPlay&
> 86350 THEN LastPlay&
= 0 'make the midnight jump (what are little kids doing up?) '==========================================================================================
ELSEIF G.Status
= GameMode
THEN 'player is in game
'================================Game Music Area===========================================
IF LastPlay&
> 86250 THEN LastPlay&
= 0 'make the midnight jump (what are little kids doing up?) '==========================================================================================
'-------------------------------------------------------------------------------------------
FOR i%%
= 1 TO LoadedMusic
FOR i%%
= 1 TO LoadedSounds
'start at 1 so if 0 sounds loaded nothing is affected
SUB Display_Card
(X%
, Y%
, id%%
, Scale!
) 'Scale options 1,1.5,2,2.5(Full,1\2,1\4,1\8[these values for refernce only, not correct])
'full-12 cards, 1.5- 24 cards, 2-48 cards, 2.5- 96 cards!
_PUTIMAGE (X%
, Y%
)-STEP(157 / Scale!
, 157 / Scale!
), Layer
(2), Layer
(1), (Cards
(id%%
).X1
, Cards
(id%%
).Y1
)-(Cards
(id%%
).X2
, Cards
(id%%
).Y2
) ELSE 'card 0 is back side _PUTIMAGE (X%
, Y%
)-STEP(157 / Scale!
, 157 / Scale!
), Layer
(2), Layer
(1), (384, 166)-STEP(159, 159)
CardsLeft%% = (BoardX(G.Level * 2 - 1) + 1) * (BoardY(G.Level * 2 - 1) + 1) 'how many cards to match
Create_ClickMap GameMode 'set the click space
Setup_Cards G.Level 'ready the cards for matching
Opt%% = Mouse_Over
ButtonDown%% = TRUE
Clicked%% = TRUE
ButtonDown%% = FALSE
IF Opt%%
THEN 'dont allow 0 click area(black area) IF Board
(Opt%%
).Flipped
= FALSE
THEN Board(Opt%%).Flipped = TRUE
Clicked%% = FALSE
card(flipped%%) = Opt%% 'watch which cards are flipped
flipped%% = flipped%% + 1
tmp%% = Mouse_Over
'-------------------------screen update-----------------------
ClearLayer Layer(1)
Display_Game_Board_II
Display_Time_Elapsed
Display_Matches_Made
'-------------------------------------------------------------
flipped%% = 0 'reset our flipped card count
IF Board
(card
(0)).Id
= Board
(card
(1)).Id
THEN ' we have a match! :D Board(card(0)).Matched = TRUE
Board(card(1)).Matched = TRUE
CardsLeft%% = CardsLeft%% - 2
G.Match = G.Match + 1
Card_Match_Animation card()
Board(card(0)).Flipped = FALSE
Board(card(1)).Flipped = FALSE
IF CardsLeft%%
= 0 THEN 'player wins this level! G.Level = G.Level + .5
ExitFlag%% = TRUE
FOR i%%
= 0 TO 96 'erase card data Board(i%%).Id = 0
Board(i%%).Flipped = FALSE
Board(i%%).Matched = FALSE
'not enough cards so just load the first 6 cards to match(pups and 1 badge{marshal's})
J%% = J%% + 1
Board(i%%).Id = J%%
Board(i%% + 1).Id = Board(i%%).Id
cc%% = 12 'Card Count for the scramble
'add the 10 base cards then repeat 2
J%% = J%% + 1
Board(i%%).Id = J%%
Board(i%% + 1).Id = Board(i%%).Id
IF J%%
= 10 THEN J%%
= 0 'start over cc%% = 24 'Card Count for the scramble
'add the 10 base cards then repeat 2
J%% = J%% + 1
Board(i%%).Id = J%%
Board(i%% + 1).Id = Board(i%%).Id
IF J%%
= 10 THEN J%%
= 0 'start over cc%% = 48 'Card Count for the scramble
'add the 10 base cards then repeat 2
J%% = J%% + 1
Board(i%%).Id = J%%
Board(i%% + 1).Id = Board(i%%).Id
IF J%%
= 10 THEN J%%
= 0 'start over cc%% = 70 'Card Count for the scramble
'scramble cards
SUB Display_Game_Board
(opt%%
) CASE Level_1
' 12 full sized cards C%% = C%% + 1
Board(C%%).X = x%%: Board(C%%).Y = y%%
Display_Card 50 + x%% * 175, 75 + y%% * 175, Board(C%%).Id, 1
Display_Card 50 + x%% * 175, 75 + y%% * 175, 0, 1
CASE Level_2
'24 half sized cards C%% = C%% + 1
Display_Card 50 + x%% * 115, 75 + y%% * 115, Board(C%%).Id, 1.5
Display_Card 50 + x%% * 115, 75 + y%% * 115, 0, 1.5
C%% = C%% + 1
Display_Card 50 + x%% * 88, 75 + y%% * 88, Board(C%%).Id, 2
Display_Card 50 + x%% * 88, 75 + y%% * 88, 0, 2
C%% = C%% + 1
Display_Card 50 + x%% * 64, 75 + y%% * 64, Board(C%%).Id, 2
Display_Card 50 + x%% * 64, 75 + y%% * 64, 0, 2
SUB Display_Game_Board_II
Offset% = 175 / G.Level 'card spacing
FOR y%%
= 0 TO BoardY
(G.Level
* 2 - 1) FOR x%%
= 0 TO BoardX
(G.Level
* 2 - 1) C%% = C%% + 1
Board(C%%).X = x%%: Board(C%%).Y = y%%
IF NOT Board
(C%%
).Matched
THEN 'if the card is matched do not display IF Board
(C%%
).Flipped
THEN 'if player has flipped card then display image Display_Card 50 + x%% * Offset%, 75 + y%% * Offset%, Board(C%%).Id, G.Level
ELSE 'otherwise display back of card Display_Card 50 + x%% * Offset%, 75 + y%% * Offset%, 0, G.Level
IF G.Status
= GameMode
THEN 'count time while playing G.time = G.time + 1
ELSE 'when in menu reset game time G.time = 0
IF G.time \
60 THEN T$
= min$
+ ":" + sec$
ELSE T$
= sec$
SND_FadeOut
MFI_Loader_victory "Victory.ANI"
Offset% = 175 / G.Level 'card spacing
'blank out cards
LINE (50 + Board
(c
(0)).X
* Offset%
, 75 + Board
(c
(0)).Y
* Offset%
)-STEP(157 / G.Level
, 157 / G.Level
), _RGB32(0), BF
LINE (50 + Board
(c
(1)).X
* Offset%
, 75 + Board
(c
(1)).Y
* Offset%
)-STEP(157 / G.Level
, 157 / G.Level
), _RGB32(0), BF
'make a tme copy of the desktop
'----------------------card start points----------------------------
StartX! = 50 + Board(c(0)).X * Offset%
StartY! = 75 + Board(c(0)).Y * Offset%
Start2X! = 50 + Board(c(1)).X * Offset%
Start2Y! = 75 + Board(c(1)).Y * Offset%
'-------------------------------------------------------------------
'----------------------distance to center---------------------------
IF StartX!
< 320 THEN Card1X_dist%
= 320 - StartX!
ELSE Card1X_dist%
= -(StartX!
- 320) IF StartY!
< 220 THEN Card1Y_dist%
= 220 - StartY!
ELSE Card1Y_dist%
= -(StartY!
- 220) IF Start2X!
< 320 THEN Card2X_dist%
= 320 - Start2X!
ELSE Card2X_dist%
= -(Start2X!
- 320) IF Start2Y!
< 220 THEN Card2Y_dist%
= 220 - Start2Y!
ELSE Card2Y_dist%
= -(Start2Y!
- 220) '-------------------------------------------------------------------
'------------travel per frame for 60 moves----------------
x1! = Card1X_dist% / 60
y1! = Card1Y_dist% / 60
x2! = Card2X_dist% / 60
y2! = Card2Y_dist% / 60
'---------------------------------------------------------
StartX! = StartX! + x1!
StartY! = StartY! + y1!
Start2X! = Start2X! + x2!
Start2Y! = Start2Y! + y2!
Display_Card StartX!, StartY!, Board(c(0)).Id, G.Level
Display_Card Start2X!, Start2Y!, Board(c(1)).Id, G.Level
count% = count% + 1
IF count%
= 61 THEN Exitflag%%
= TRUE
Starty%
= INT(StartX!
) - 48
c% = c% + 15
Display_Card 5 + Startx% - c%, Starty% - c%, Board(c(0)).Id, i!
c% = c% - 20
Display_Card Startx% - c%, Starty% - c%, Board(c(0)).Id, i!
_PUTIMAGE (Startx%
- c%
- 33, Starty%
- c%
- 33)-STEP(190 / (i!
- .05), 183 / (i!
- .05)), Layer
(14), Layer
(1), (0 + 191 * f%%
, 0)-STEP(190, 183) f%% = f%% + 1
'$include:'PPMG_GFXRoutines.bas'
SUB MFI_Loader_victory
(FN$
) GET #1, , c~%%
'retrieve number of files FOffset&(I~%%) = FOffset&(I~%%) + 1
ClearLayer Layer(1)
ClearLayer Layer(0)
fr%% = fr%% + 1
tmp& = LoadGFX(FOffset(fr%%), Size(fr%%))
IF fr%%
= 95 THEN Exitflag%%
= TRUE
tmp& = LoadGFX(FOffset(92), Size(92))
FUNCTION LoadFFX&
(Foff&
, Size&
, Fize%%
, Att$
) LoadFFX&
= _LOADFONT("temp.dat", Fize%%
, Att$
)
SUB LoadData
(Foff&
, Size&
)
GET #1, , c~%%
'retrieve number of files FOffset&(I~%%) = FOffset&(I~%%) + 1
'-----------------------Splash Screen setup-------------------------
Splash& = LoadGFX(FOffset(9), Size(9)) 'Splash screen
BGM(1) = LoadSFX(FOffset(1), Size(1))
TIMER(T&
) ON 'start the background musics SetVolumes 'adjust volume levels
Fade_In Splash&
'-------------------------------------------------------------------
Layer
(7) = _NEWIMAGE(800, 600, 32) 'click map layer Layer
(8) = _NEWIMAGE(800, 600, 32) 'Main Menu\Options Layer Layer
(9) = _NEWIMAGE(800, 600, 32) 'High Score\Help layer Layer
(10) = _NEWIMAGE(800, 600, 32) 'Mouse Over hi-lite layer Layer
(12) = _NEWIMAGE(800, 600, 32) 'debug info
Layer(2) = LoadGFX(FOffset(2), Size(2)) 'Tiles
Layer(3) = LoadGFX(FOffset(3), Size(3)) 'Title
Layer(4) = LoadGFX(FOffset(4), Size(4)) 'BackGround
Layer(5) = LoadGFX(FOffset(5), Size(5)) 'Pups
Layer(6) = LoadGFX(FOffset(6), Size(6)) 'bitmap font
Layer(11) = LoadGFX(FOffset(7), Size(7)) 'high score title
Layer(13) = LoadGFX(FOffset(8), Size(8)) 'Victory screen title
Layer(14) = LoadGFX(FOffset(14), Size(14)) 'Match sparkle animation
BGM(2) = LoadSFX(FOffset(10), Size(10)) 'instramental theme
BGM(3) = LoadSFX(FOffset(11), Size(11)) 'extended instramental
SFX(1) = LoadSFX(FOffset(12), Size(12)) 'victory cheer
FFX(0) = LoadFFX(FOffset(13), Size(13), 36, "BOLD") 'main font
FFX(1) = LoadFFX(FOffset(13), Size(13), 24, "") 'high score font
FFX(2) = LoadFFX(FOffset(13), Size(13), 24, "MONOSPACE") 'help font