Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 485
» Latest member: zenevan
» Forum threads: 2,802
» Forum posts: 26,364

Full Statistics

Latest Threads
Masakari - the abandoned ...
Forum: Programs
Last Post: Sanmayce
1 hour ago
» Replies: 0
» Views: 23
What do you guys like to ...
Forum: General Discussion
Last Post: Pete
1 hour ago
» Replies: 23
» Views: 507
Merry X-Mas 2024!!
Forum: General Discussion
Last Post: NakedApe
2 hours ago
» Replies: 13
» Views: 235
QB64PE v4.0 is now live!!
Forum: Announcements
Last Post: RhoSigma
4 hours ago
» Replies: 39
» Views: 1,610
DeflatePro
Forum: a740g
Last Post: aadityap0901
4 hours ago
» Replies: 4
» Views: 138
Smallish Games
Forum: bplus
Last Post: bplus
8 hours ago
» Replies: 20
» Views: 1,369
Mean user base makes Stev...
Forum: General Discussion
Last Post: Pete
Today, 06:12 AM
» Replies: 27
» Views: 666
GNU C++ Compiler error
Forum: Help Me!
Last Post: eoredson
Today, 05:27 AM
» Replies: 55
» Views: 1,522
SaucerZap
Forum: QBJS, BAM, and Other BASICs
Last Post: CharlieJV
Today, 04:37 AM
» Replies: 9
» Views: 139
Printing to image handle
Forum: Utilities
Last Post: Pete
Today, 03:14 AM
» Replies: 8
» Views: 132

 
  The Brain Game from Australia
Posted by: SMcNeill - 12-23-2023, 10:02 PM - Forum: Donald Foster - No Replies

Quote:Hello All,.

The Brain from Australia is a 2 player board game originally made on my Tandy 2000. I could not find a copy of the rules, I peeked at my source code from the Tandy 2000 printout to figure out the rules. Hopefully I got it right.

The Game is played on a 13x13 game board with alternating orange and green spots on the board for players to place their pieces on. There are also groups of 2x2 grey squares grouped under the color spots around the board. One player plays with 26 white pieces and the other plays with 26 black pieces.

The game came be won by placing 4 of your pieces in a row and skipping one space in between each of your pieces or by occupying all 4 grey squares that are grouped of your color.

If after each player has placed all 26 of their pieces on the board and there is no winner yet, places can move the their pieces already on the board.

Hope you enjoy playing.

Donald

   

Code: (Select All)
_Title "The Brain Game From Australia by Donald L. Foster Jr. 2018"

Screen _NewImage(1020, 735, 256)

_PaletteColor 1, _RGB32(200, 200, 200) ' Lt Grey
_PaletteColor 2, _RGB32(180, 180, 180) ' Med Grey
_PaletteColor 3, _RGB32(255, 100, 0) ' Orange
_PaletteColor 4, _RGB32(0, 200, 50) ' Green
_PaletteColor 5, _RGB32(0, 50, 255) ' Blue

Dim Player As Integer
Dim Opponent As Integer

Dim V As Integer
Dim W As Integer
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

Dim PlayerColor(2) As Integer
Dim PlayerPieces(2) As Integer

Dim X(2) As Integer

Dim BoardX(13, 13) As Integer
Dim BoardY(13, 13) As Integer

Dim StorageX(2, 26) As Integer
Dim StorageY(2, 26) As Integer

Dim BoardPlayer(13, 13) As Integer
Dim BoardSquare(13, 13) As Integer
Dim WinningSquare(13, 13) As Integer

Dim C(2) As String
Dim Cursor As String

Player = 1: Opponent = 2
PlayerColor(1) = 15: PlayerColor(2) = 0
PlayerPieces(1) = 1: PlayerPieces(2) = 1

C$(1) = "C15": C$(2) = "C0"
Cursor$ = "C0BU25RL26D50R50U50L51D51R52U52L52"

' Setup Grey Board Squares
For Z = 2 To 11 Step 3: For Y = 2 To 11 Step 3: BoardSquare(Z, Y) = 1: BoardSquare(Z, Y + 1) = 1: BoardSquare(Z + 1, Y) = 1: BoardSquare(Z + 1, Y + 1) = 1: Next: Next

Cls , 5
Color 15, 5: Locate 2, 96: Print "The Brain Game from Australia";


' Daw Board
Line (10, 10)-(725, 725), 2, BF: Line (16, 16)-(719, 719), 3, BF: Line (20, 20)-(715, 715), 15, BF
X = 56
For Z = 1 To 13
W = 56
For Y = 1 To 13
If BoardSquare(Z, Y) = 1 Then Line (W - 25, X - 25)-(W + 25, X + 25), 1, BF
If (Z + Y) / 2 = Fix((Z + Y) / 2) Then V = 3 Else V = 4
Circle (W, X), 24, V: Paint (W, X), V
BoardX(Z, Y) = W: BoardY(Z, Y) = X
W = W + 52
Next
X = X + 52
Next

' Setup Storage Pieces
X = 145: X(1) = 1: X(2) = 1
For Z = 1 To 13
W = 780
For Y = 1 To 4
If Y < 3 Then V = 1 Else V = 2
Circle (W, X), 20, PlayerColor(V): Paint (W, X), PlayerColor(V)
StorageX(V, X(V)) = W: StorageY(V, X(V)) = X
W = W + 60: X(V) = X(V) + 1
Next
X = X + 44
Next

StartGame:
' Display Player Indicator
Circle (872, 65), 21, PlayerColor(Player): Paint (872, 65), PlayerColor(Player)
Locate 7, 106: Print "Player:"; Player;

Locate 45, 94: If PlayerPieces(Player) = 27 Then Print " Choose a Piece to Move. "; Else Print " Choose Location to Place Piece. ";

GetMouseInput1:
While (_MouseInput)
For Z = 1 To 13
For Y = 1 To 13
If _MouseX > BoardX(Z, Y) - 26 And _MouseX < BoardX(Z, Y) + 26 And _MouseY > BoardY(Z, Y) - 26 And _MouseY < BoardY(Z, Y) + 26 And _MouseButton(1) = -1 Then
If (BoardPlayer(Z, Y) = 0 And PlayerPieces(Player) < 27) Or (BoardPlayer(Z, Y) = Player And PlayerPieces(Player) = 27) Then
Row1 = Z: Column1 = Y: GoSub ButtonRelease: GoTo EndMouseInput1
End If
End If
Next
Next
Wend
GoTo GetMouseInput1

EndMouseInput1:
If PlayerPieces(Player) < 27 Then
Pieces = PlayerPieces(Player)
BoardPlayer(Row1, Column1) = Player
Circle (BoardX(Row1, Column1), BoardY(Row1, Column1)), 20, PlayerColor(Player): Paint (BoardX(Row1, Column1), BoardY(Row1, Column1)), PlayerColor(Player)
Line (StorageX(Player, Pieces) - 21, StorageY(Player, Pieces) - 21)-(StorageX(Player, Pieces) + 21, StorageY(Player, Pieces) + 21), 5, BF
PlayerPieces(Player) = PlayerPieces(Player) + 1
GoTo EndTurn
End If

' Place Cursor Around Select Piece
PSet (BoardX(Row1, Column1), BoardY(Row1, Column1)), PlayerColor(Player): Draw C$(Player) + Cursor$

Locate 45, 94: Print " Choose a Location to Move to. ";

GetMouseInput2:
While (_MouseInput)
For Z = 1 To 13
For Y = 1 To 13
If _MouseX > BoardX(Z, Y) - 26 And _MouseX < BoardX(Z, Y) + 26 And _MouseY > BoardY(Z, Y) - 26 And _MouseY < BoardY(Z, Y) + 26 And _MouseButton(1) = -1 Then
If BoardPlayer(Z, Y) = 0 Then Row2 = Z: Column2 = Y: GoSub ButtonRelease: GoTo EndMouseInput2
End If
Next
Next
Wend
GoTo GetMouseInput2

EndMouseInput2:
BoardPlayer(Row1, Column1) = 0: BoardPlayer(Row2, Column2) = Player
Line (BoardX(Row1, Column1) - 26, BoardY(Row1, Column1) - 26)-(BoardX(Row1, Column1) + 26, BoardY(Row1, Column1) + 26), 15, BF
If BoardSquare(Row1, Column1) = 1 Then Line (BoardX(Row1, Column1) - 25, BoardY(Row1, Column1) - 25)-(BoardX(Row1, Column1) + 25, BoardY(Row1, Column1) + 25), 1, BF
If (Row1 + Column1) / 2 = Fix((Row1 + Column1) / 2) Then V = 3 Else V = 4
Circle (BoardX(Row1, Column1), BoardY(Row1, Column1)), 24, V: Paint (BoardX(Row1, Column1), BoardY(Row1, Column1)), V
Circle (BoardX(Row2, Column2), BoardY(Row2, Column2)), 20, PlayerColor(Player): Paint (BoardX(Row2, Column2), BoardY(Row2, Column2)), PlayerColor(Player)

EndTurn:
' Set WinningSquares to Zero
For Z = 1 To 13: For Y = 1 To 13: WinningSquare(Z, Y) = 0: Next: Next

' Check for Winner
X = 0
For Z = 2 To 11 Step 3
For Y = 2 To 11 Step 3
If BoardPlayer(Z, Y) = Player And BoardPlayer(Z, Y + 1) = Player And BoardPlayer(Z + 1, Y) = Player And BoardPlayer(Z + 1, Y + 1) = Player Then
X = 1: WinningSquare(Z, Y) = 1: WinningSquare(Z, Y + 1) = 1: WinningSquare(Z + 1, Y) = 1: WinningSquare(Z + 1, Y + 1) = 1
End If
Next
Next

For Z = 1 To 7
For Y = 1 To 13
If BoardPlayer(Y, Z) = Player And BoardPlayer(Y, Z + 2) = Player And BoardPlayer(Y, Z + 4) = Player And BoardPlayer(Y, Z + 6) = Player Then
X = 1: WinningSquare(Y, Z) = 1: WinningSquare(Y, Z + 2) = 1: WinningSquare(Y, Z + 4) = 1: WinningSquare(Y, Z + 6) = 1
End If
If BoardPlayer(Z, Y) = Player And BoardPlayer(Z + 2, Y) = Player And BoardPlayer(Z + 4, Y) = Player And BoardPlayer(Z + 6, Y) = Player Then
X = 1: WinningSquare(Z, Y) = 1: WinningSquare(Z + 2, Y) = 1: WinningSquare(Z + 4, Y) = 1: WinningSquare(Z + 6, Y) = 1
End If
Next
Next

For Z = 1 To 7
For Y = 1 To 7
If BoardPlayer(Z, Y) = Player And BoardPlayer(Z + 2, Y + 2) = Player And BoardPlayer(Z + 4, Y + 4) = Player And BoardPlayer(Z + 6, Y + 6) = Player Then
X = 1: WinningSquare(Z, Y) = 1: WinningSquare(Z + 2, Y + 2) = 1: WinningSquare(Z + 4, Y + 4) = 1: WinningSquare(Z + 6, Y + 6) = 1
End If
If BoardPlayer(14 - Y, Z) = Player And BoardPlayer(12 - Y, Z + 2) = Player And BoardPlayer(10 - Y, Z + 4) = Player And BoardPlayer(8 - Y, Z + 6) = Player Then
X = 1: WinningSquare(14 - Y, Z) = 1: WinningSquare(12 - Y, Z + 2) = 1: WinningSquare(10 - Y, Z + 4) = 1: WinningSquare(8 - Y, Z + 6) = 1
End If
Next
Next

If X = 1 GoTo Winner

Swap Player, Opponent: GoTo StartGame


ButtonRelease:
While (_MouseInput)
If _MouseButton(1) = 0 Then Return
Wend
GoTo ButtonRelease


Winner:
For Z = 1 To 13
For Y = 1 To 13
If WinningSquare(Z, Y) = 1 Then PSet (BoardX(Z, Y), BoardY(Z, Y)), PlayerColor(Player): Draw C$(Player) + Cursor$
Next
Next

Locate 45, 94: Print " Winner! Play Again? ( Y / N ) ";

YorN:
A$ = UCase$(InKey$)
If A$ = "" GoTo YorN
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo YorN

Print this item

  Shogun Board Game
Posted by: SMcNeill - 12-23-2023, 09:49 PM - Forum: Donald Foster - No Replies

Quote:Hello all,

Shogun is a 2 player board game. Each player has 7 pawns and 1 king piece. The object of the game is to either (1) capture your opponent's king or (2) capture 6 of your opponent's pawns. Pieces are captured by landing on them, like in chess. The pieces has a rotating disc inside with numbers from 1 to 4 on it. A window at the top of the piece reveals 1 of the digits on the disc. This number represents how many spaces that piece moves on that turn. There is a magnet located on the disc inside the piece and each positions on the board has a magnet in different locations. As the pieces move to different locations, the disc rotates an reveals a new number for that location. A piece can make 1 turn during it's move. There is a button at the bottom of the right hand side that allows the players to display the possible moves. This can be toggled on and off. When a player selects a piece, a white cursor surrounds that piece. If the player wishes to choose a different piece, they can select the same and the piece will be deselected. When the show moves is selected, gold cursors surround all then locations a piece can move to

I have included a photo which has a copy of the rules on it.

Hope you enjoy playing.


   

   

Code: (Select All)
_Title "Shogun 1976 - Programmed by Donald L. Foster Jr."

Screen _NewImage(1010, 736, 32)

_Limit 10: Randomize Timer

Black& = _RGB(0, 0, 0): White& = _RGB(255, 255, 255): Gold& = _RGB(255, 215, 0): Grey& = _RGB(120, 120, 120)

PlayerColor1&(1) = _RGB(200, 0, 0): PlayerColor1&(2) = _RGB(225, 198, 151)
PlayerColor2&(1) = _RGB(255, 0, 0): PlayerColor2&(2) = _RGB(255, 228, 181)

Player = 1: Opponent = 2
ShowMoves = 0: UdateMoves = 0: ButtonPressed = 0

PawnCount(1) = 7: PawnCount(2) = 7: Captured(1) = 0: Captured(2) = 0
CapturedX(1) = 797: CapturedX(2) = 938: X = 0: For Z = 1 To 6: CapturedY(Z) = 225 + X: X = X + 80: Next

BoardMagnetPosition$(1) = "1414323223234141141432322323414132321414414123233232141441412323"
BoardMagnetPosition$(2) = "2121434334341212212143432121434334341212434321214343212112123434"
BoardMagnetPosition$(3) = "3232141441412323323214144141232314143232232341411414323223234141"
BoardMagnetPosition$(4) = "4343212112123434434321211212343421214343343412122121434334341212"

PiecePattern$(1) = "14232314213423144213423142132112"
PiecePattern$(2) = "23143421342134211423314231421221"

Cursor$ = "D76R76U76L77D77R78U78L78"

Crown$(1) = "R16TA65R31TA220R19TA140R19TA220R19TA140R19TA295R31TA0R16"
Crown$(2) = "L16TA65L31TA220L19TA140L19TA220L19TA140L19TA295L31TA0L18"

Piece$(1) = "TA0R29TA135R39TA225R39TA0R29BU10"
Piece$(2) = "TA0L29TA135L39TA225L39TA0L29BD10"

Number$(1) = "BR2BU10L4D20R4U20"
Number$(2) = "BU10BR5L12D4R8D4L8D12R12U4L8U4R8U12"
Number$(3) = "BU10BR5L12D4R8D4L4D4R4D4L8D4R12U20"
Number$(4) = "BU10BR5L4D8L4U8L4D12R8D8R4U20"

' Setup Piece Magnet Patterns
For Z = 1 To 2: W = 1: For Y = 1 To 8: For X = 1 To 4: PieceValue(Z, Y, X) = Val(Mid$(PiecePattern$(Z), W, 1)): W = W + 1: Next: Next: Next

' Setup Board Rotation
Rotation = Int(Rnd * 4) + 1

'Setup Board Magnet
W = 1: For Z = 1 To 8: For Y = 1 To 8: BoardMagnet(Z, Y) = Val(Mid$(BoardMagnetPosition$(Rotation), W, 1)): W = W + 1: Next: Next

' Setup King Location
Z = Int(Rnd * 2): If Z = 0 Then BoardPiece(1, 5) = 8: BoardPiece(8, 4) = 8 Else BoardPiece(1, 4) = 8: BoardPiece(8, 5) = 8

' Setup Pawn Locations
For Z = 1 To 7
    X = 0
    While (X = 0)
        Y = Int(Rnd * 8) + 1: If BoardPiece(1, Y) = 0 Then BoardPiece(1, Y) = Z: X = 1
    Wend
    X = 0
    While (X = 0)
        Y = Int(Rnd * 8) + 1: If BoardPiece(8, Y) = 0 Then BoardPiece(8, Y) = Z: X = 1
    Wend
Next

' Draw Board
Line (0, 0)-(1010, 736), _RGB(255, 255, 255), BF

X = 100
For Z = 0 To 9
    Line (10 + Z, 30)-(10 + Z, 706), _RGB(X, X, X)
    Line (726 - Z, 30)-(726 - Z, 706), _RGB(X, X, X)
    Line (30, 10 + Z)-(706, 10 + Z), _RGB(X, X, X)
    Line (30, 726 - Z)-(706, 726 - Z), _RGB(X, X, X)
    Circle (30, 30), 20 - Z, _RGB(X, X, X), 1.5, 3.1
    Circle (30, 706), 20 - Z, _RGB(X, X, X), 3.0, 4.8
    Circle (706, 30), 20 - Z, _RGB(X, X, X), 0, 1.7
    Circle (706, 706), 20 - Z, _RGB(X, X, X), 4.6, 0
    Paint (100, 100), _RGB(X, X, X)
    X = X - 10
Next

Paint (100, 100), _RGB(X + 10, X + 10, X + 10)

X = 0
For Z = 1 To 8
    W = 0
    For Y = 1 To 8
        If Z = 1 Then BoardPlayer(Z, Y) = 2 Else If Z = 8 Then BoardPlayer(Z, Y) = 1
        If (Z + Y) / 2 = Fix((Z + Y) / 2) Then A& = _RGB(50, 50, 50) Else A& = _RGB(40, 40, 40)
        Line (83 - 37 + W, 83 - 37 + X)-(83 + 37 + W, 83 + 37 + X), A&, BF
        If BoardPlayer(Z, Y) > 0 Then X1 = 83 + W: X2 = 83 + X: X3 = BoardPlayer(Z, Y): X4 = BoardPiece(Z, Y): X5 = PieceValue(X3, X4, BoardMagnet(Z, Y)): GoSub DrawPiece
        BoardX(Z, Y) = 83 + W: BoardY(Z, Y) = 83 + X
        W = W + 82
    Next
    X = X + 82
Next

Color Black&, White&: Locate 2, 99: Print "S  H  O  G  U  N";

' Display Show Moves Button
GoSub ShowMovesButton

StartGame:
' Draw Player Indicator
X1 = 867: X2 = 80: X3 = Player: X4 = 1: X5 = 1: GoSub DrawPiece

Color Black&, White&: Locate 9, 105: Print "Player:"; Player;

' Set Playable Moves to 0
For Z = 1 To 8: For Y = 1 To 8: Playable(Z, Y) = 0: Next: Next

' Is King in ChecK?
If Check = 1 Then Color Black&, White&: Locate 11, 98: Print "YOUR KING IS IN CHECK!!";

GetChooseAPieceInput:
Do While _MouseInput
    MouseX = _MouseX: MouseY = _MouseY: MouseLeftButton = _MouseButton(1)

    If (MouseX > 772) * (MouseX < 946) * (MouseY > 679) * (MouseY < 711) * (_MouseButton(1) = -1) Then ButtonPressed = 1: GoSub ShowMovesButton: GoSub ButtonReleased

    For Z = 1 To 8
        For Y = 1 To 8
            If (MouseLeftButton = -1) * (MouseX > BoardX(Z, Y) - 38) * (MouseX < BoardX(Z, Y) + 38) * (MouseY > BoardY(Z, Y) - 38) * (MouseY < BoardY(Z, Y) + 38) Then
                If BoardPlayer(Z, Y) = Player Then Row1 = Z: Column1 = Y: GoTo EndChoice1
            End If
        Next
    Next
Loop
GoTo GetChooseAPieceInput

EndChoice1:
' Get Value of Piece Selected.
Piece = PieceValue(Player, BoardPiece(Row1, Column1), BoardMagnet(Row1, Column1))

' Set All Playable Moves to 0.
For Z = 1 To 8: For Y = 1 To 8: Playable(Z, Y) = 0: Next: Next

' Check location for Legal Moves.
X1 = Row1: X2 = Column1: X = 0: On Piece GOSUB Piece1, Piece2, Piece3, Piece4

' Is This Location Legal?
If X = 0 Then GoTo GetChooseAPieceInput

' Draw Cursor Around piece to be Moved.
PSet (BoardX(X1, X2) - 38, BoardY(X1, X2) - 38), White&: Draw Cursor$

' Display Playable Moves
If ShowMoves = 1 Then UpdateMoves = 1: GoSub ShowMovesButton: UpdateMoves = 0

GetChooseLocationInput:
Do While _MouseInput
    MouseX = _MouseX: MouseY = _MouseY: MouseLeftButton = _MouseButton(1)
    If (MouseX > 772) * (MouseX < 946) * (MouseY > 679) * (MouseY < 711) * (_MouseButton(1) = -1) Then ButtonPressed = 1: GoSub ShowMovesButton: GoSub ButtonReleased
    For Z = 1 To 8
        For Y = 1 To 8
            If (MouseLeftButton = -1) * (MouseX > BoardX(Z, Y) - 38) * (MouseX < BoardX(Z, Y) + 38) * (MouseY > BoardY(Z, Y) - 38) * (MouseY < BoardY(Z, Y) + 38) Then
                Row2 = Z: Column2 = Y: GoTo EndChoice2
            End If
        Next
    Next
Loop
GoTo GetChooseLocationInput

EndChoice2:
If (Row2 = Row1) * (Column2 = Column1) Then Reselect = 1: GoTo Cursors Else Reselect = 0

'Check if Position is Playable?
If Playable(Row2, Column2) = 0 Then GoTo GetChooseLocationInput

Cursors:
' Remove Cursors from Board
For Z = 1 To 8
    For Y = 1 To 8
        Playable(Z, Y) = 0: PSet (BoardX(Z, Y) - 38, BoardY(Z, Y) - 38), Black&: Draw Cursor$
    Next
Next

' Check for Reselect Piece
If Reselect = 1 Then GoTo GetChooseAPieceInput

' Check for Capture
If BoardPlayer(Row2, Column2) = Opponent Then
    Captured(Opponent) = Captured(Opponent) + 1
    X1 = CapturedX(Opponent): X2 = CapturedY(Captured(Opponent))
    X3 = Opponent: X4 = BoardPiece(Row2, Column2): X5 = PieceValue(X3, X4, BoardMagnet(Row2, Column2)): GoSub DrawPiece
    If BoardPiece(Row2, Column2) = 8 Then Winner = Player Else If BoardPlayer(Row2, Column2) = Opponent Then PawnCount(Opponent) = PawnCount(Opponent) - 1
End If

' Transfer Piece Information to New Location
BoardPlayer(Row2, Column2) = Player: BoardPiece(Row2, Column2) = BoardPiece(Row1, Column1)

' Remove Piece Information from Old Location
BoardPlayer(Row1, Column1) = 0: BoardPiece(Row1, Column1) = 0

' Remove Piece from Old Location
If (Row1 + Column1) / 2 = Fix((Row1 + Column1) / 2) Then A& = _RGB(50, 50, 50) Else A& = _RGB(40, 40, 40)
Line (BoardX(Row1, Column1) - 37, BoardY(Row1, Column1) - 37)-(BoardX(Row1, Column1) + 37, BoardY(Row1, Column1) + 37), A&, BF

' Redraw Piece in New Location
X1 = BoardX(Row2, Column2): X2 = BoardY(Row2, Column2): X3 = Player: X4 = BoardPiece(Row2, Column2): X5 = PieceValue(X3, X4, BoardMagnet(Row2, Column2)): GoSub DrawPiece

Color Black&, White&: Locate 11, 98: Print "                      ";

'Check for King in Check.
Check = 0: X = 0
For Z = 1 To 8
    For Y = 1 To 8
        Playable(Z, Y) = 0
        If BoardPlayer(Z, Y) = Player Then
            Piece = PieceValue(Player, BoardPiece(Z, Y), BoardMagnet(Z, Y))
            X1 = Z: X2 = Y: On Piece GOSUB Piece1, Piece2, Piece3, Piece4
        End If
    Next
Next

' Check for Winner
If Winner > 0 Then GoTo Winner
If PawnCount(Opponent) = 1 Then Winner = Player: GoTo Winner

Moves = 1: Swap Player, Opponent: GoTo StartGame


DrawPiece:
If X3 = 1 Then W1 = -17: W2 = 32: W3 = 20 Else W1 = 17: W2 = -32: W3 = -20

Line (X1 - 37, X2 - 32)-(X1 - 37, X2 + 32), PlayerColor1&(X3)
Line (X1 + 37, X2 - 32)-(X1 + 37, X2 + 32), PlayerColor1&(X3)
Line (X1 - 32, X2 - 37)-(X1 + 32, X2 - 37), PlayerColor1&(X3)
Line (X1 - 32, X2 + 37)-(X1 + 32, X2 + 37), PlayerColor1&(X3)
Circle (X1 - 32, X2 - 32), 5, PlayerColor1&(X3), 1.5, 3.0
Circle (X1 - 32, X2 + 32), 5, PlayerColor1&(X3), 3.0, 4.8
Circle (X1 + 32, X2 - 32), 5, PlayerColor1&(X3), 0, 1.6
Circle (X1 + 32, X2 + 32), 5, PlayerColor1&(X3), 4.5, 0
Paint (X1, X2), PlayerColor1&(X3)
Circle (X1, X2 + W1), 15, Black&: Paint (X1, X2 + W1), Black&
PSet (X1, X2 + W1), White&: Draw Number$(X5): Paint (X1 + 1, X2 + W1), White&

If X4 = 8 Then
    PSet (X1, X2 + W2), Black&: Draw Crown$(X3): Paint (X1, X2 + W3 - 5), Gold&, Black&
Else
    PSet (X1, X2 + W2), PlayerColor2&(X3): Draw Piece$(X3): Paint (X1, X2 + W3), PlayerColor2&(X3)
End If
Return


Piece1:
Y1 = X1: Y2 = X2: Moves = 0: V = 0: GoSub CheckUp: Moves = 0: V = 0: GoSub CheckRight: Moves = 0: V = 0: GoSub CheckDown: Moves = 0: V = 0: GoSub CheckLeft
Return

Piece2:
If X1 - 1 >= 1 Then If BoardPlayer(X1 - 1, X2) = 0 Then Y1 = X1 - 1: Y2 = X2: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckRight
If X2 + 1 <= 8 Then If BoardPlayer(X1, X2 + 1) = 0 Then Y1 = X1: Y2 = X2 + 1: Moves = 1: V = 0: GoSub CheckDown: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckRight
If X1 + 1 <= 8 Then If BoardPlayer(X1 + 1, X2) = 0 Then Y1 = X1 + 1: Y2 = X2: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckDown: Moves = 1: V = 0: GoSub CheckRight
If X2 - 1 >= 1 Then If BoardPlayer(X1, X2 - 1) = 0 Then Y1 = X1: Y2 = X2 - 1: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckDown
Return

Piece3:
If X1 - 1 >= 1 Then If BoardPlayer(X1 - 1, X2) = 0 Then Y1 = X1 - 1: Y2 = X2: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckRight
If X2 + 1 <= 8 Then If BoardPlayer(X1, X2 + 1) = 0 Then Y1 = X1: Y2 = X2 + 1: Moves = 1: V = 0: GoSub CheckDown: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckRight
If X1 + 1 <= 8 Then If BoardPlayer(X1 + 1, X2) = 0 Then Y1 = X1 + 1: Y2 = X2: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckDown: Moves = 1: V = 0: GoSub CheckRight
If X2 - 1 >= 1 Then If BoardPlayer(X1, X2 - 1) = 0 Then Y1 = X1: Y2 = X2 - 1: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckDown

If X1 - 2 >= 1 Then If (BoardPlayer(X1 - 1, X2) = 0) * (BoardPlayer(X1 - 2, X2) = 0) Then Y1 = X1 - 2: Y2 = X2: Moves = 2: V = 0: GoSub CheckLeft: Moves = 2: V = 0: GoSub CheckUp: Moves = 2: V = 0: GoSub CheckRight
If X2 + 2 <= 8 Then If (BoardPlayer(X1, X2 + 1) = 0) * (BoardPlayer(X1, X2 + 2) = 0) Then Y1 = X1: Y2 = X2 + 2: Moves = 2: V = 0: GoSub CheckDown: Moves = 2: V = 0: GoSub CheckUp: Moves = 2: V = 0: GoSub CheckRight
If X1 + 2 <= 8 Then If (BoardPlayer(X1 + 1, X2) = 0) * (BoardPlayer(X1 + 2, X2) = 0) Then Y1 = X1 + 2: Y2 = X2: Moves = 2: V = 0: GoSub CheckLeft: Moves = 2: V = 0: GoSub CheckDown: Moves = 2: V = 0: GoSub CheckRight
If X2 - 2 >= 1 Then If (BoardPlayer(X1, X2 - 1) = 0) * (BoardPlayer(X1, X2 - 2) = 0) Then Y1 = X1: Y2 = X2 - 2: Moves = 2: V = 0: GoSub CheckLeft: Moves = 2: V = 0: GoSub CheckUp: Moves = 2: V = 0: GoSub CheckDown
Return

Piece4:
If X1 - 1 >= 1 Then If BoardPlayer(X1 - 1, X2) = 0 Then Y1 = X1 - 1: Y2 = X2: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckRight
If X2 + 1 <= 8 Then If BoardPlayer(X1, X2 + 1) = 0 Then Y1 = X1: Y2 = X2 + 1: Moves = 1: V = 0: GoSub CheckDown: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckRight
If X1 + 1 <= 8 Then If BoardPlayer(X1 + 1, X2) = 0 Then Y1 = X1 + 1: Y2 = X2: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckDown: Moves = 1: V = 0: GoSub CheckRight
If X2 - 1 >= 1 Then If BoardPlayer(X1, X2 - 1) = 0 Then Y1 = X1: Y2 = X2 - 1: Moves = 1: V = 0: GoSub CheckLeft: Moves = 1: V = 0: GoSub CheckUp: Moves = 1: V = 0: GoSub CheckDown

If X1 - 2 >= 1 Then If (BoardPlayer(X1 - 1, X2) = 0) * (BoardPlayer(X1 - 2, X2) = 0) Then Y1 = X1 - 2: Y2 = X2: Moves = 2: V = 0: GoSub CheckLeft: Moves = 2: V = 0: GoSub CheckUp: Moves = 2: V = 0: GoSub CheckRight
If X2 + 2 <= 8 Then If (BoardPlayer(X1, X2 + 1) = 0) * (BoardPlayer(X1, X2 + 2) = 0) Then Y1 = X1: Y2 = X2 + 2: Moves = 2: V = 0: GoSub CheckDown: Moves = 2: V = 0: GoSub CheckUp: Moves = 2: V = 0: GoSub CheckRight
If X1 + 2 <= 8 Then If (BoardPlayer(X1 + 1, X2) = 0) * (BoardPlayer(X1 + 2, X2) = 0) Then Y1 = X1 + 2: Y2 = X2: Moves = 2: V = 0: GoSub CheckLeft: Moves = 2: V = 0: GoSub CheckDown: Moves = 2: V = 0: GoSub CheckRight
If X2 - 2 >= 1 Then If (BoardPlayer(X1, X2 - 1) = 0) * (BoardPlayer(X1, X2 - 2) = 0) Then Y1 = X1: Y2 = X2 - 2: Moves = 2: V = 0: GoSub CheckLeft: Moves = 2: V = 0: GoSub CheckUp: Moves = 2: V = 0: GoSub CheckDown

If X1 - 3 >= 1 Then If (BoardPlayer(X1 - 1, X2) = 0) * (BoardPlayer(X1 - 2, X2) = 0) * (BoardPlayer(X1 - 3, X2) = 0) Then Y1 = X1 - 3: Y2 = X2: Moves = 3: V = 0: GoSub CheckLeft: Moves = 3: V = 0: GoSub CheckUp: Moves = 3: V = 0: GoSub CheckRight
If X2 + 3 <= 8 Then If (BoardPlayer(X1, X2 + 1) = 0) * (BoardPlayer(X1, X2 + 2) = 0) * (BoardPlayer(X1, X2 + 3) = 0) Then Y1 = X1: Y2 = X2 + 3: Moves = 3: V = 0: GoSub CheckDown: Moves = 3: V = 0: GoSub CheckUp: Moves = 3: V = 0: GoSub CheckRight
If X1 + 3 <= 8 Then If (BoardPlayer(X1 + 1, X2) = 0) * (BoardPlayer(X1 + 2, X2) = 0) * (BoardPlayer(X1 + 3, X2) = 0) Then Y1 = X1 + 3: Y2 = X2: Moves = 3: V = 0: GoSub CheckLeft: Moves = 3: V = 0: GoSub CheckDown: Moves = 3: V = 0: GoSub CheckRight
If X2 - 3 >= 1 Then If (BoardPlayer(X1, X2 - 1) = 0) * (BoardPlayer(X1, X2 - 2) = 0) * (BoardPlayer(X1, X2 - 3) = 0) Then Y1 = X1: Y2 = X2 - 3: Moves = 3: V = 0: GoSub CheckLeft: Moves = 3: V = 0: GoSub CheckUp: Moves = 3: V = 0: GoSub CheckDown
Return


CheckUp:
If Y1 - V - 1 >= 1 Then
    V = V + 1
    If (Moves + V = Piece) * (BoardPlayer(Y1 - V, Y2) = Opponent) * (BoardPiece(Y1 - V, Y2) = 8) Then Check = 1
    If (Moves + V = Piece) * (BoardPlayer(Y1 - V, Y2) <> Player) Then Playable(Y1 - V, Y2) = 1: X = 1: Return
    If (Moves + V < Piece) * (BoardPlayer(Y1 - V, Y2) = 0) Then GoTo CheckUp
    Return
Else Return
End If
Return

CheckRight:
If Y2 + V + 1 <= 8 Then
    V = V + 1
    If (Moves + V = Piece) * (BoardPlayer(Y1, Y2 + V) = Opponent) * (BoardPiece(Y1, Y2 + V) = 8) Then Check = 1
    If (Moves + V = Piece) * (BoardPlayer(Y1, Y2 + V) <> Player) Then Playable(Y1, Y2 + V) = 1: X = 1: Return
    If (Moves + V < Piece) * (BoardPlayer(Y1, Y2 + V) = 0) Then GoTo CheckRight
    Return
Else Return
End If
Return

CheckDown:
If Y1 + V + 1 <= 8 Then
    V = V + 1
    If (Moves + V = Piece) * (BoardPlayer(Y1 + V, Y2) = Opponent) * (BoardPiece(Y1 + V, Y2) = 8) Then Check = 1
    If (Moves + V = Piece) * (BoardPlayer(Y1 + V, Y2) <> Player) Then Playable(Y1 + V, Y2) = 1: X = 1: Return
    If (Moves + V < Piece) * (BoardPlayer(Y1 + V, Y2) = 0) Then GoTo CheckDown
    Return
Else Return
End If
Return

CheckLeft:
If Y2 - V - 1 >= 1 Then
    V = V + 1
    If (Moves + V = Piece) * (BoardPlayer(Y1, Y2 - V) = Opponent) * (BoardPiece(Y1, Y2 - V) = 8) Then Check = 1
    If (Moves + V = Piece) * (BoardPlayer(Y1, Y2 - V) <> Player) Then Playable(Y1, Y2 - V) = 1: X = 1: Return
    If (Moves + V < Piece) * (BoardPlayer(Y1, Y2 - V) = 0) Then GoTo CheckLeft
    Return
Else Return
End If
Return


ShowMovesButton:
If ButtonPressed = 1 Then ButtonPressed = 0: If ShowMoves = 0 Then ShowMoves = 1 Else ShowMoves = 0

Line (780, 680)-(955, 710), Grey&, BF
Color White&, Grey&: Locate 44, 100: If ShowMoves = 1 Then Print "  Don't Show Moves  "; Else Print "Show Playable Moves";

For Z = 1 To 8
    For Y = 1 To 8
        If (Z = Row1) * (Y = Column1) Then GoTo Skip
        If ShowMoves = 0 Then PSet (BoardX(Z, Y) - 38, BoardY(Z, Y) - 38), Black&: Draw Cursor$
        If ShowMoves = 1 Then If Playable(Z, Y) = 1 Then PSet (BoardX(Z, Y) - 38, BoardY(Z, Y) - 38), Gold&: Draw Cursor$
        Skip:
    Next
Next

Return


ButtonReleased:
Do While _MouseInput
    If _MouseButton(1) = 0 Then Return
Loop
GoTo ButtonReleased


Winner:
Locate 9, 98: Print "Player"; Player; "is the Winner!";

Locate 11, 96: Print "Play Another Game?  (Y / N)"

GetYorN:
A$ = UCase$(InKey$)
If A$ = "" Then GoTo GetYorN
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo GetYorN

Print this item

  Maryanne Board Game
Posted by: SMcNeill - 12-23-2023, 09:35 PM - Forum: Donald Foster - No Replies

   

Quote:Hello All,

Maryann is a board game I designed and named it after my wife. I put together a board game that combine rules, features and characteristics of different board games.

The game is played on an 8x8 checkered board with 8 round discs lined up on each back row with arrows on top. The arrows point to the location where it can move to next. Each players turn consists of 2 moves. Moves consists on either one of the following: rotate player's piece, move a piece 1 space up,down, right, left, or diagonal, jump own pieces diagonal or capture opponent's piece up, down, left or right. A piece can be rotated on the same move, counts as 2 moves, Can move 1 piece twice or 2 pieces once. As pieces are removed from rows and columns the outer rows and columns are removed from the board. The winner is the player who captures their opponents first.

Donald

Code: (Select All)
Option _Explicit

' I used a code snippet by bplus modified to enlarge the characters on the screen.

_Title "Maryann - Designed and Programmed by Donald L. Foster Jr. 2018 - Code Snippet by bplus"

Screen _NewImage(1014, 735, 256)

_PaletteColor 1, _RGB32(6, 55, 255) ' Player 1 Piece Color
_PaletteColor 2, _RGB32(255, 61, 0) ' Player 2 Piece Color
_PaletteColor 3, _RGB32(127, 127, 127) ' Board Background Color
_PaletteColor 4, _RGB32(244, 244, 11) ' Arrow Color
_PaletteColor 5, _RGB32(80, 80, 80) ' Cursor Color

_Limit 10

Dim A As String
Dim V As _Unsigned Integer
Dim W As _Unsigned Integer
Dim X As _Unsigned Integer
Dim Y As _Unsigned _Byte
Dim Z As _Unsigned _Byte

Dim X1 As _Unsigned Integer
Dim X2 As _Unsigned Integer
Dim X3 As _Unsigned Integer
Dim X4 As _Unsigned Integer

Dim Player As _Unsigned _Byte
Dim Opponent As _Unsigned _Byte
Dim Winner As _Unsigned _Byte
Dim MovesLeft As _Unsigned _Byte
Dim CanSelect As _Unsigned _Byte
Dim Rotation As _Unsigned _Byte
Dim SquareColor1 As _Unsigned _Byte
Dim SquareColor2 As _Unsigned _Byte

Dim BoardX1 As _Unsigned Integer
Dim BoardY1 As _Unsigned Integer
Dim BoardX2 As _Unsigned Integer
Dim BoardY2 As _Unsigned Integer

Dim Rotate As _Unsigned _Byte

Dim TopBoardEdge As _Unsigned _Byte
Dim BottomBoardEdge As _Unsigned _Byte
Dim LeftBoardEdge As _Unsigned _Byte
Dim RightBoardEdge As _Unsigned _Byte

Dim Row1 As _Unsigned _Byte
Dim Column1 As _Unsigned _Byte
Dim Row2 As _Unsigned _Byte
Dim Column2 As _Unsigned _Byte

Dim PlayerColor(2) As Integer
Dim Pieces(2) As _Unsigned _Byte

Dim BoardX(8, 8) As _Unsigned Integer
Dim BoardY(8, 8) As _Unsigned Integer
Dim BoardPlayer(8, 8) As _Unsigned _Byte
Dim BoardRotate(8, 8) As _Unsigned _Byte
Dim Playable(8, 8) As _Unsigned _Byte
Dim RotationX(8) As _Unsigned Integer
Dim RotationY(8) As _Unsigned Integer

Dim Arrow As String
Dim Cursor As String
Dim Cursor1 As String
Dim TA$(8)
Dim Message As String

Player = 1: Opponent = 2
Pieces(1) = 8: Pieces(2) = 8
PlayerColor(1) = 1: PlayerColor(2) = 2

TopBoardEdge = 1: BottomBoardEdge = 8: LeftBoardEdge = 1: RightBoardEdge = 8

' Setup Pieces on Board
Data 6,8,6,8,6,8,5,1,5,1,4,2,4,2,4,2
For Z = 1 To 8: BoardPlayer(1, Z) = 2: BoardPlayer(8, Z) = 1: Read BoardRotate(1, Z), BoardRotate(8, Z): Next

Cursor$ = "TA0BU43BL43C5D86R86U86L86BF2D82R82U82L82BU1P5,5"
Cursor1$ = "TA0BU43BL43C0D86R86U86L86BF2D82R82U82L82BU1P0,0"
Arrow$ = "BD20BL10C4R20U20R10H20G20R10D20R10BU10P4,4"
TA$(1) = "TA0": TA$(2) = "TA45": TA$(3) = "TA90": TA$(4) = "TA135": TA$(5) = "TA180": TA$(6) = "TA225": TA$(7) = "TA270": TA$(8) = "TA315"

' Draw Game Title Message
Message$ = " Maryann ": X1 = 727: X2 = 2: X3 = 15: X4 = 4: GoSub DrawMessage
Line (0, 0)-(100, 30), 0, BF

' Draw Board
Line (10, 10)-(724, 724), 3, BF: ' LINE (12, 12)-(723, 723), 3, BF
X = 59
For Z = 1 To 8
W = 59
For Y = 1 To 8
If (Z + Y) / 2 = Fix((Z + Y) / 2) Then V = 0 Else V = 15
Line (W - 43, X - 43)-(W + 43, X + 43), V, BF
If BoardPlayer(Z, Y) > 0 Then X1 = W: X2 = X: X3 = PlayerColor(BoardPlayer(Z, Y)): X4 = BoardRotate(Z, Y): GoSub DrawPiece
BoardX(Z, Y) = W: BoardY(Z, Y) = X
W = W + 88
Next
X = X + 88
Next


StartGame:
MovesLeft = 2

' Draw Player Indicator
X1 = 863: X2 = 130: X3 = Player: X4 = 1: GoSub DrawPiece
Locate 12, 105: Print "Player"; Player;

MovesLeft: Locate 45, 104: Print "Moves Left:"; MovesLeft;

Locate 16, 100: Print " Choose a Piece. ";

ChooseAPieceInput:
Do While _MouseInput
For Z = 1 To 8
For Y = 1 To 8
If _MouseButton(1) = -1 And _MouseX > BoardX(Z, Y) - 44 And _MouseX < BoardX(Z, Y) + 44 And _MouseY > BoardY(Z, Y) - 44 And _MouseY < BoardY(Z, Y) + 44 Then
If BoardPlayer(Z, Y) = Player Then Row1 = Z: Column1 = Y: GoSub ReleaseMouseButton: GoTo EndChoice1
End If
Next
Next
Loop
GoTo ChooseAPieceInput

EndChoice1:
BoardX1 = BoardX(Row1, Column1): BoardY1 = BoardY(Row1, Column1): Rotate = BoardRotate(Row1, Column1)

' Get Color Row1 Column1 Square
If (Row1 + Column1) / 2 = Fix((Row1 + Column1) / 2) Then SquareColor1 = 0 Else SquareColor1 = 15

' Draw Cursor After Piece is Selected
PSet (BoardX(Row1, Column1), BoardY(Row1, Column1)), 4: Draw Cursor$

' Set All Playable Locations to 0
For Z = 1 To 8: For Y = 1 To 8: Playable(Z, Y) = 0: Next: Next

' Get Playable Locations
Playable(Row1, Column1) = 1

On Rotate GOSUB Check_Up, Check_Up_Left, Check_Left, Check_Down_Left, Check_Down, Check_Down_Right, Check_Right, Check_Up_Right

Locate 16, 100: Print "Choose a Location. ";

' Draw Piece Rotations
X = 0: V = 1
For Z = 1 To 7 Step 2
W = 0
For Y = 0 To 1
X1 = 810 + W: X2 = 315 + X: X3 = Player: X4 = V: GoSub DrawPiece
RotationX(Z + Y) = 810 + W: RotationY(Z + Y) = 315 + X
W = W + 110: V = V + 1
Next
X = X + 110
Next

Locate 16, 100: Print "Choose a Rotation. ";

GetRotationMouseInput:
Do While _MouseInput
For Z = 1 To 8
If _MouseX > RotationX(Z) - 44 And _MouseX < RotationX(Z) + 44 And _MouseY > RotationY(Z) - 44 And _MouseY < RotationY(Z) + 44 Then
CanSelect = 1: PSet (RotationX(Z), RotationY(Z)), 4: Draw Cursor$
Else
CanSelect = 0: PSet (RotationX(Z), RotationY(Z)), 4: Draw Cursor1$
End If
If _MouseButton(1) = -1 And CanSelect = 1 Then Rotation = Z: GoSub ReleaseMouseButton: GoTo EndChoice2
Next
Loop
GoTo GetRotationMouseInput

EndChoice2:
If Rotation <> Rotate Then MovesLeft = MovesLeft - 1: Locate 45, 104: Print "Moves Left:"; MovesLeft; 'ELSE Rotation = Rotate

If MovesLeft = 0 Then
' Remove Piece Rotations
Line (766, 271)-(964, 689), 0, BF

' Set Current Piece To New Rotation Position
BoardRotate(Row1, Column1) = Rotation

' Remove Cursor and Piece From Current Location
Line (BoardX1 - 43, BoardY1 - 43)-(BoardX1 + 43, BoardY1 + 43), SquareColor1, BF

' Redraw Piece in Current Position With New Rotation
X1 = BoardX1: X2 = BoardY1: X3 = Player: X4 = Rotation: GoSub DrawPiece: GoTo EndTurn
End If

ChooseALocationInput:
Do While _MouseInput
For Z = 1 To 8
For Y = 1 To 8
If _MouseButton(1) = -1 And _MouseX > BoardX(Z, Y) - 44 And _MouseX < BoardX(Z, Y) + 44 And _MouseY > BoardY(Z, Y) - 44 And _MouseY < BoardY(Z, Y) + 44 Then
If Playable(Z, Y) = 1 Then Row2 = Z: Column2 = Y: GoSub ReleaseMouseButton: GoTo EndChoice3
End If
Next
Next
Loop
GoTo ChooseALocationInput

EndChoice3:

' Get New Location Information
BoardX2 = BoardX(Row2, Column2): BoardY2 = BoardY(Row2, Column2)
If (Row2 + Column2) / 2 = Fix((Row2 + Column2) / 2) Then SquareColor2 = 0 Else SquareColor2 = 15

' Piece stayed at Same Location
If Row2 = Row1 And Column2 = Column1 Then
Line (BoardX1 - 43, BoardY1 - 43)-(BoardX1 + 43, BoardY1 + 43), SquareColor1, BF
BoardRotate(Row2, Column2) = Rotation: X1 = BoardX2: X2 = BoardY2: X3 = Player: X4 = Rotation: GoSub DrawPiece
Line (766, 271)-(964, 689), 0, BF: GoTo MovesLeft
End If

' Remove Piece Rotations
Line (766, 271)-(964, 689), 0, BF

' Check If Opponent's Piece is Captured
If BoardPlayer(Row2, Column2) = Opponent Then Pieces(Opponent) = Pieces(Opponent) - 1

' Assign New Location to Player
BoardPlayer(Row2, Column2) = Player: BoardRotate(Row2, Column2) = Rotation

' Set Old Location to 0
BoardPlayer(Row1, Column1) = 0: BoardRotate(Row1, Column1) = 0

' Clear Piece and Cursors From Old Location
Line (BoardX1 - 43, BoardY1 - 43)-(BoardX1 + 43, BoardY1 + 43), SquareColor1, BF

' Clear New Location
Line (BoardX2 - 43, BoardY2 - 43)-(BoardX2 + 43, BoardY2 + 43), SquareColor2, BF

' Redraw Piece at New Location
X1 = BoardX2: X2 = BoardY2: X3 = Player: X4 = Rotation: GoSub DrawPiece

' Substract 1 from MovesLeft
MovesLeft = MovesLeft - 1: Locate 45, 104: Print "Moves Left:"; MovesLeft;

' Check if a Row or Column is Empty
X1 = 0: X2 = 0: X3 = 0: X4 = 0

For Z = 1 To 8
If BoardPlayer(TopBoardEdge, Z) > 0 Then X1 = 1
If BoardPlayer(BottomBoardEdge, Z) > 0 Then X2 = 1
If BoardPlayer(Z, LeftBoardEdge) > 0 Then X3 = 1
If BoardPlayer(Z, RightBoardEdge) > 0 Then X4 = 1
Next

If X1 = 0 Then Y = TopBoardEdge: For Z = 1 To 8: Line (BoardX(Y, Z) - 43, BoardY(Y, Z) - 43)-(BoardX(Y, Z) + 43, BoardY(Y, Z) + 43), 3, BF: Next: TopBoardEdge = TopBoardEdge + 1
If X2 = 0 Then Y = BottomBoardEdge: For Z = 1 To 8: Line (BoardX(Y, Z) - 43, BoardY(Y, Z) - 43)-(BoardX(Y, Z) + 43, BoardY(Y, Z) + 43), 3, BF: Next: BottomBoardEdge = BottomBoardEdge - 1
If X3 = 0 Then Y = LeftBoardEdge: For Z = 1 To 8: Line (BoardX(Z, Y) - 43, BoardY(Z, Y) - 43)-(BoardX(Z, Y) + 43, BoardY(Z, Y) + 43), 3, BF: Next: LeftBoardEdge = LeftBoardEdge + 1
If X4 = 0 Then Y = RightBoardEdge: For Z = 1 To 8: Line (BoardX(Z, Y) - 43, BoardY(Z, Y) - 43)-(BoardX(Z, Y) + 43, BoardY(Z, Y) + 43), 3, BF: Next: RightBoardEdge = RightBoardEdge - 1

' Check for Winner
If Pieces(Opponent) = 0 Then GoTo Winner

' Check if Still Have More Moves
If MovesLeft > 0 Then GoTo MovesLeft

EndTurn:
Swap Player, Opponent: GoTo StartGame


DrawPiece:
Circle (X1, X2), 36, X3: Paint (X1, X2), X3
PSet (X1, X2), X3: Draw TA$(X4) + Arrow$
Return


DrawMessage:
Color 15, V: Locate 1, 1: Print Message$;
W = 8 * Len(Message$): X = 16

For Y = 0 To X
For Z = 0 To W
If Point(Z, Y) <> 0 Then Line (X1 + Z * X4, X2 + Y * X4)-(X1 + Z * X4 + X4, X2 + Y * X4 + X4), 15, BF
Next
Next
Return


ReleaseMouseButton:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo ReleaseMouseButton


Check_Up:
If Row1 - 1 >= TopBoardEdge Then If BoardPlayer(Row1 - 1, Column1) <> Player Then Playable(Row1 - 1, Column1) = 1
Return

Check_Up_Left:
If Row1 - 1 >= TopBoardEdge And Column1 - 1 >= LeftBoardEdge Then
If BoardPlayer(Row1 - 1, Column1 - 1) = 0 Then Playable(Row1 - 1, Column1 - 1) = 1
If BoardPlayer(Row1 - 1, Column1 - 1) = Player Then
If Row1 - 2 >= TopBoardEdge And Column1 - 2 >= LeftBoardEdge Then If BoardPlayer(Row1 - 2, Column1 - 2) = 0 Then Playable(Row1 - 2, Column1 - 2) = 1
End If
End If
Return

Check_Left:
If Column1 - 1 >= LeftBoardEdge Then If BoardPlayer(Row1, Column1 - 1) <> Player Then Playable(Row1, Column1 - 1) = 1
Return

Check_Down_Left:
If Row1 + 1 <= BottomBoardEdge And Column1 - 1 >= LeftBoardEdge Then
If BoardPlayer(Row1 + 1, Column1 - 1) = 0 Then Playable(Row1 + 1, Column1 - 1) = 1
If BoardPlayer(Row1 + 1, Column1 - 1) = Player Then
If Row1 + 2 <= BottomBoardEdge And Column1 - 2 >= LeftBoardEdge Then If BoardPlayer(Row1 + 2, Column1 - 2) = 0 Then Playable(Row1 + 2, Column1 - 2) = 1
End If
End If
Return

Check_Down:
If Row1 + 1 <= BottomBoardEdge Then If BoardPlayer(Row1 + 1, Column1) <> Player Then Playable(Row1 + 1, Column1) = 1
Return

Check_Down_Right:
If Row1 + 1 <= BottomBoardEdge And Column1 + 1 <= RightBoardEdge Then
If BoardPlayer(Row1 + 1, Column1 + 1) = 0 Then Playable(Row1 + 1, Column1 + 1) = 1
If BoardPlayer(Row1 + 1, Column1 + 1) = Player Then
If Row1 + 2 <= BottomBoardEdge And Column1 + 2 <= RightBoardEdge Then If BoardPlayer(Row1 + 2, Column1 + 2) = 0 Then Playable(Row1 + 2, Column1 + 2) = 1
End If
End If
Return

Check_Right:
If Column1 + 1 <= RightBoardEdge Then If BoardPlayer(Row1, Column1 + 1) <> Player Then Playable(Row1, Column1 + 1) = 1
Return

Check_Up_Right:
If Row1 - 1 >= TopBoardEdge And Column1 + 1 <= RightBoardEdge Then
If BoardPlayer(Row1 - 1, Column1 + 1) = 0 Then Playable(Row1 - 1, Column1 + 1) = 1
If BoardPlayer(Row1 - 1, Column1 + 1) = Player Then
If Row1 - 2 >= TopBoardEdge And Column1 + 2 <= RightBoardEdge Then If BoardPlayer(Row1 - 2, Column1 + 2) = 0 Then Playable(Row1 - 2, Column1 + 2) = 1
End If
End If
Return


Winner:
Locate 16, 96: Print " Player"; Player; "is the Winner!! ";

Locate 18, 96: Print "Play Another Game? ( Y / N )";

Locate 45, 104: Print " ";

GetYorN:
A$ = UCase$(InKey$)
If A$ = "" Then GoTo GetYorN
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo GetYorN

Print this item

  Zelda 64 (Zelda Clone by Cobalt)
Posted by: SMcNeill - 12-23-2023, 01:22 PM - Forum: Games - Replies (3)

After taking a peek at Craz1000's Master Sword game (based on the NES game Zelda) reminded me of my Zelda Clone I started in March 2018! So I brought it up, deleted all the code and started from scratch!
And here is my past Weeks worth of work on it!

Temporary controls(Defaults)

Letter controls are UPPER CASE!

A - Start Button
B - Select Button (change selection(option) in game selection screen)
Space Bar - Button A (attack)
Enter - Button B(not used yet)
Arrow Keys - Map navigation, letter selection

The Title Scroll works!
The Game Selection menus all work, Pick a game to resume, Register a name, and Elimination Mode.
Once Registering and picking your character you can Explore the map.
At the moment the map is empty, no creatures to combat, No caves or dungeons to enter. You do start with the first sword so blast and slash away!

took me a few hours to get the map traversing done, took 4 DAYS to get the title screen and game selection screens working!

Really putting this up here to see what people think of the Title screen and Selection screens, and to see if anyone can break those parts.

I should warn you it is possible to get stuck, if you change map screens and the next screen bottle necks down you can wind up stuck in rock. There is no way to undo this yet, you have to quit.

As I do not have the OPTIONS screen done yet, there is one option you can manually play with if you like, the Scale option. There are 3 settings; LINE 116:G.Scale_Factor = 1
1- Small(actual game size) 256x224px
2- Normal 512x448px
3- Large 768x672px

at scale 1 a debugging map of the game is displayed at the top of the screen, the yellow square is you.

(developed in 2.0.2, but tested on 1.4,1.5,and 1.6 all work[should work with all versions back to 1.1build82])



Code: (Select All)
'Zelda Clone take 2

Type ControllerKeys
KBCon_Up As Long
KBCon_Down As Long
KBCon_Left As Long
KBCon_Right As Long
KBCon_Select As Long
KBCon_Start As Long
KBCon_A_Button As Long
KBCon_B_Button As Long
End Type

Type Game_Data
Impactflag As _Byte
Scale_Factor As _Byte
Scale_X As _Byte
Scale_Y As _Byte
NextScreen As _Byte
Wtime As _Byte
Atime As _Byte
Wframe As _Byte
Aframe As _Byte
Projectile_Count As _Byte
LoadedGame As _Byte 'which game is loaded?(1-3)
End Type

Type Projectile_Data
Id As _Byte ' Kind of projectile; Sword\Arrow\Rock\Ball
Xloc As Integer ' Projectile location
Yloc As Integer '
Direction As _Byte 'Direction Projectile is traveling
Hits As _Byte ' Hits per projectile\(AKA:damage) in half heart increments
Owner As _Byte ' Who shot the projectile
End Type

Type Links_Data
'-----Position data-----
World As _Byte ' Player in Overworld or Underworld
World_X As _Byte ' Overworld X position
World_Y As _Byte ' Overworld Y position
Tile_X As _Unsigned _Byte 'Array X location:for Collision\entrances
Tile_Y As _Byte ' Array Y location:for Collision\entrances
Screen_X As Integer ' X Position on screen
Screen_Y As Integer ' Y Position on screen
Direction As _Byte ' Direction player is moving\facing
'-----------------------
'------Status Data------
Hearts As _Byte ' Units of health: 2 units(halves) per heart
Containers As _Byte 'Max number of health: total full hearts
Hits As _Byte ' Used when Link has defence rings;Blue = 2 hits per 1\2 heart, Red = 4 hits per 1\2 heart
'-----------------------
'------Items Data-------
Sword As _Byte ' which Sword does player have? Wooden-1,Silver-2,Magical-3
Weapon As _Byte 'Which Weapon is in hand A? Wooden-1,Silver-2,Magical-3,Wand-4
Ring As _Byte 'which does player have? 0-none, 1-blue,2-red
'-----------------------
'------Extra Data-------
Action As _Byte ' is player; using an item, Aquiring an item\sword, or aquiring a piece of the triforce?
Shot As _Byte ' player has shot sword
Projectile_id As _Byte '
Played As _Unsigned _Byte 'how many times has player played?
Beaten As _Byte ' Has player beaten Game 1? Game 2?
'-----------------------
End Type

Type Map_Data
Id As _Unsigned _Byte 'Tile id
Hidden As _Byte ' is there something under the tile?
Burnable As _Byte ' can the tile be burnt with candle?
Pushable As _Byte ' can the tile be moved by pushing?
PushableXtra As _Byte 'can the tile be moved by pushing with braclet?
Is_Shop As _Byte ' is there a shop here?(shop\gift\gamble)
Walkable As _Byte ' can the tile be walk upon?
End Type


Const TRUE = -1, FALSE = Not TRUE, None = 0
Const Up = 3, Right = 2, Left = 1, Down = 0, SELECT_BUTTON = 4, START_BUTTON = 5, BUTTON_B = 6, BUTTON_A = 7
Const OverWorld = 0, UnderWorld = 1
Const Walking = 1, Useing = 2, GetItem = 3, GetTriforce = 4, Attack = 5
Const Key_Right = 19712, Key_Left = 19200, Key_Up = 18432, Key_Down = 20480
Const Key_Space = 32, Key_Enter = 13
Const Default_Key_Right = 19712, Default_Key_Left = 19200, Default_Key_Up = 18432, Default_Key_Down = 20480
Const Default_A_Button = 32, Default_B_Button = 13, Default_Start_Button = 65, Default_Select_Button = 66
Const Sword = 1, Arrow = 2, Rock = 3, Ball = 4, Boomerang = 5
Const Player = 1, Monster = 2
Const Item = 0, Slash = 1, Stairs = 2, SwordShot = 3

Dim Shared Layer(16) As Long, Hyrule(255, 87) As Map_Data, Link As Links_Data, Reset_Link As Links_Data
Dim Shared C As ControllerKeys, G As Game_Data, P(16) As Projectile_Data, Letter(44) As String * 1
Dim Shared Offset_X(3) As Integer, Offset_Y(3) As Integer, Cave(15, 10) As Map_Data
Dim Shared BGM(8) As Long, SFX(10) As Long, FFX(1) As Long
Dim Shared Records(3) As Links_Data, Nick(3) As String * 8 'loading\registering\elimination

Screen _NewImage(800, 600, 32)

Layer(0) = _Display
Layer(1) = _NewImage(800, 600, 32) 'temp layer
Layer(2) = _NewImage(640, 480, 256) 'palettized sprite sheet for color shifting
Layer(3) = _NewImage(800, 600, 32) 'Map background prebuild layer
Layer(4) = _NewImage(800, 600, 32) 'Mob layer
Layer(5) = _NewImage(800, 600, 32) 'Sprite layer, moveable\burnable items + bomb holes + pickups
Layer(6) = _NewImage(12288, 4224, 32) 'PreBuilt Map, upto 300%, for easier map scrolling.
Layer(8) = _NewImage(800, 600, 32) 'debug map display
Layer(16) = _NewImage(800, 600, 32) 'temp

MFI_Loader "Zelda.MFI"

_ClearColor _RGB32(31), Layer(7)
_ClearColor _RGB32(116), Layer(12)
_ScreenMove 10, 10


'==================================
G.Scale_Factor = 1
G.Scale_X = 16 * G.Scale_Factor - 1
G.Scale_Y = 16 * G.Scale_Factor - 1
Link.Screen_X = Offset_X(G.Scale_Factor) + (16 * G.Scale_Factor * 7) + 8 * G.Scale_Factor '392
Link.Screen_Y = Offset_Y(G.Scale_Factor) + (16 * G.Scale_Factor * 5) '292
Nick(0) = "": Nick(1) = "": Nick(2) = "": Nick(3) = ""
'==================================

'OPEN "debug.txt" FOR OUTPUT AS #6
Build_Map_Screen 16 * Link.World_X, 11 * Link.World_Y
ClearLayer Layer(6)
Build_Map_in_Totallity 'prebuild the entire map at the current scale factor
ClearLayer Layer(1)
_Font FFX(0), Layer(1)
_Font FFX(0), Layer(16)
Title_Screen
Select_Screen

Do
Select Case Get_Input
Case BUTTON_A
If G.Aframe = 0 And G.Atime = 0 Then _SndPlay SFX(Slash): Link.Action = Attack: Press = Press + 1
Check_Link_Sword_Shot
Case Up
If Link.Action <> Attack Then Link.Direction = Up: Link.Action = Walking
Case Down
If Link.Action <> Attack Then Link.Direction = Down: Link.Action = Walking
Case Right
If Link.Action <> Attack Then Link.Direction = Right: Link.Action = Walking
Case Left
If Link.Action <> Attack Then Link.Direction = Left: Link.Action = Walking
Case Else
If Link.Action = Walking Then Link.Action = None
End Select

If Link.Action = GetItem Or Link.Action = GetTriforce Then
If Not _SndPlaying(Temp&) Then Link.Action = None
End If
'------Graphx build------
_PutImage , Layer(3), Layer(1)
If Link.Action = Walking Then Move_Link
If Link.Shot Then Move_Sword_Shot
If G.Impactflag Then Impact 0, 0
Place_Link
' _PRINTSTRING (0, 0), STR$(Link.Tile_X) + STR$(Link.Tile_Y) + STR$(G.Projectile_Count), Layer(1)
If G.Scale_Factor = 1 Then _PutImage , Layer(8), Layer(1)
_Dest Layer(1)
Line (100 + 2 * Link.Tile_X, 0 + 2 * Link.Tile_Y)-Step(1, 1), _RGB32(255, 255, 0), BF
_PutImage , Layer(1), Layer(0)
ClearLayer Layer(1)
'------------------------
If InKey$ = Chr$(27) Then ExitFlag%% = TRUE
_Limit 60
Loop Until ExitFlag%%


Sub Add_Projectile (What%%, Who%%)
Select Case What%%
Case Sword
P(G.Projectile_Count).Owner = Who%%
P(G.Projectile_Count).Id = Sword
P(G.Projectile_Count).Direction = Link.Direction
If Who%% = Player Then
P(G.Projectile_Count).Xloc = Link.Screen_X
P(G.Projectile_Count).Yloc = Link.Screen_Y
Else
End If
G.Projectile_Count = G.Projectile_Count + 1
End Select
End Sub

Sub Remove_Projectile (What%%, Who%%)
Select Case What%%
Case Sword
If Who%% = Player Then
G.Projectile_Count = G.Projectile_Count - 1
End If
End Select
End Sub

Sub Build_Cave_Screen
For Y%% = 0 To 10
For X%% = 0 To 15
Place_Tile_On_Screen (16 * G.Scale_Factor) * X%%, (16 * G.Scale_Factor) * Y%%, Cave(X%%, Y%%).Id, Layer(3)
Next
Next
End Sub

Sub Build_Map_Screen (Map_X~%%, Map_Y%%)
_Dest Layer(8)
For Y%% = 0 To 10
For X%% = 0 To 15
Place_Tile_On_Screen (16 * G.Scale_Factor) * X%%, (16 * G.Scale_Factor) * Y%%, Hyrule(Map_X~%% + X%%, Map_Y%% + Y%%).Id, Layer(3)
Next
Next
For Y%% = 0 To 87
For x~%% = 0 To 255
If Hyrule(x~%%, Y%%).Walkable = FALSE Then Line (100 + 2 * x~%%, 0 + 2 * Y%%)-Step(1, 1), _RGB32(255), BF
Next
Next
_Dest Layer(0)
End Sub

Sub Build_Map_in_Totallity
For Y%% = 0 To 87
For X~%% = 0 To 255
tile~%% = Hyrule(X~%%, Y%%).Id
Gy% = 17 * (tile~%% \ 20) 'get which row it comes from
Gx% = 17 * (tile~%% Mod 20) 'which column position
_PutImage ((16 * G.Scale_Factor) * X~%%, (16 * G.Scale_Factor) * Y%%)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(6), (1 + Gx%, 1 + Gy%)-Step(15, 15)
Next
Next
End Sub

Sub Check_Link_Location
Ax% = Link.World_X * 16 * (16 * G.Scale_Factor) 'gets the Left most pixel point for the current map screen
Ay% = Link.World_Y * 11 * (16 * G.Scale_Factor) 'gets the Top most pixel point for the current map screen
Tx~%% = (Ax% + Link.Screen_X - Offset_X(G.Scale_Factor) + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent x-offset+50% sprite size
Ty%% = (Ay% + Link.Screen_Y - Offset_Y(G.Scale_Factor) - 2 + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent y-offset+50% sprite size
If Hyrule(Tx~%%, Ty%%).Is_Shop Then Enter_Shop Hyrule(Tx~%%, Ty%%).Is_Shop

End Sub

Sub Enter_Shop (Which%%)
End Sub

Sub Check_Link_Sword_Shot 'Can Link shoot his sword?
If Link.Hearts = Link.Containers * 2 Then 'Link has full hearts and can shoot
If Not _SndPlaying(SFX(SwordShot)) Then 'Link did not just shoot
If Not G.Impactflag Then 'Link's last shot has finished
If Not Link.Shot Then
_SndPlay SFX(SwordShot)
Link.Shot = TRUE
Add_Projectile Sword, Player
End If
End If
End If
End If
End Sub

Sub ClearLayer (L&)
_Dest L&
Cls
_Dest _Display
End Sub

Sub ClearLayerTrans (L&)
_Dest L&
Cls , 0
_Dest _Display
End Sub

Sub DarkenImage (Image As Long, Value_From_0_To_1 As Single)
If Value_From_0_To_1 <= 0 Or Value_From_0_To_1 >= 1 Or _PixelSize(Image) <> 4 Then Exit Sub
Dim Buffer As _MEM: Buffer = _MemImage(Image) 'Get a memory reference to our image
Dim Frac_Value As Long: Frac_Value = Value_From_0_To_1 * 65536 'Used to avoid slow floating point calculations
Dim O As _Offset, O_Last As _Offset
O = Buffer.OFFSET 'We start at this offset
O_Last = Buffer.OFFSET + _Width(Image) * _Height(Image) * 4 'We stop when we get to this offset
'use on error free code ONLY!
$Checking:Off
Do
_MemPut Buffer, O, _MemGet(Buffer, O, _Unsigned _Byte) * Frac_Value \ 65536 As _UNSIGNED _BYTE
_MemPut Buffer, O + 1, _MemGet(Buffer, O + 1, _Unsigned _Byte) * Frac_Value \ 65536 As _UNSIGNED _BYTE
_MemPut Buffer, O + 2, _MemGet(Buffer, O + 2, _Unsigned _Byte) * Frac_Value \ 65536 As _UNSIGNED _BYTE
O = O + 4
Loop Until O = O_Last
'turn checking back on when done!
$Checking:On
_MemFree Buffer
End Sub

Sub Fade_Out (L&)
For n! = 1 To 0.5 Step -0.05
i2& = _CopyImage(L&)
DarkenImage i2&, n!
_PutImage (0, 0), i2&, Layer(0)
_FreeImage i2&
_Delay .03
Next
End Sub

Sub Fade_In (L&)
For n! = 0.01 To 1 Step 0.05
i2& = _CopyImage(L&)
DarkenImage i2&, n!
_PutImage (0, 0), i2&, Layer(0)
_FreeImage i2&
_Delay .03
Next
End Sub

Function Find_First_Available%% (Which%%, Start%%)
Selection%% = Start%% 'always start at the first saved game slot then check
Do 'lets find the first available selection (if there are any saved games)
If Selection%% < 4 Then
If Which%% = 0 Then If RTrim$(Nick(Selection%%)) = "" Then Selection%% = Selection%% + 1 Else Good_Selection%% = TRUE
If Which%% = 1 Then If RTrim$(Nick(Selection%%)) = "" Then Good_Selection%% = TRUE Else Selection%% = Selection%% + 1
Else '4 and 5 are always good selections
Good_Selection%% = TRUE
End If
Loop Until Good_Selection%%
Find_First_Available = Selection%%
End Function

Function Get_Input%% ()
Result%% = TRUE '-1 for no input
' SELECT CASE G.ControlType
' CASE TRUE 'Keyboard input
If _KeyDown(C.KBCon_Up) Then Result%% = Up
If _KeyDown(C.KBCon_Down) Then Result%% = Down
If _KeyDown(C.KBCon_Left) Then Result%% = Left
If _KeyDown(C.KBCon_Right) Then Result%% = Right
If _KeyDown(C.KBCon_Select) Then Result%% = SELECT_BUTTON: ' DO: LOOP WHILE _KEYDOWN(C.KBCon_Select)
If _KeyDown(C.KBCon_Start) Then Result%% = START_BUTTON: ' DO: LOOP WHILE _KEYDOWN(C.KBCon_Start)
If _KeyDown(C.KBCon_A_Button) Then Result%% = BUTTON_A: ' DO: LOOP WHILE _KEYDOWN(C.KBCon_A_Button)
If _KeyDown(C.KBCon_B_Button) Then Result%% = BUTTON_B: ' DO: LOOP WHILE _KEYDOWN(C.KBCon_B_Button)
' CASE FALSE 'joystick input
'IF C.Control_Pad THEN
'IF NOT G.Flag THEN DO: LOOP WHILE _DEVICEINPUT(C.Control_Pad)
'IF NOT C.BAD_Pad THEN
' nul%% = AxisPower(CJR%%, CJL%%, CJU%%, CJD%%) 'read directional axis values
' IF CJU%% THEN Result%% = Up
' IF CJD%% THEN Result%% = Down
' IF CJL%% THEN Result%% = Left
' IF CJR%% THEN Result%% = Right
'ELSE
' IF _BUTTON(C.Joy_Button_Up) THEN Result%% = Up ': Joy_Lock_Button (C.Joy_Button_Up)
' IF _BUTTON(C.Joy_Button_Down) THEN Result%% = Down ': Joy_Lock_Button (C.Joy_Button_Down)
' IF _BUTTON(C.Joy_Button_Left) THEN Result%% = Left ': Joy_Lock_Button (C.Joy_Button_Left)
' IF _BUTTON(C.Joy_Button_Right) THEN Result%% = Right ': Joy_Lock_Button (C.Joy_Button_Right)
' END IF
' IF _BUTTON(C.Joy_Select) THEN Result%% = SELECT_BUTTON: Joy_Lock_Button (C.Joy_Select)
' IF _BUTTON(C.Joy_Start) THEN Result%% = START_BUTTON: Joy_Lock_Button (C.Joy_Start)
' IF _BUTTON(C.Joy_A_Button) THEN Result%% = BUTTON_A: Joy_Lock_Button (C.Joy_A_Button)
' IF _BUTTON(C.Joy_B_Button) THEN Result%% = BUTTON_B: Joy_Lock_Button (C.Joy_B_Button)
' END IF
' END SELECT
Get_Input = Result%%
End Function

Sub Link_Attack
Select Case Link.Direction
Case Up
Ox%% = 0: Oy%% = -14 * G.Scale_Factor
Case Down
Ox%% = 0: Oy%% = 14 * G.Scale_Factor
Case Left
Ox%% = -14 * G.Scale_Factor + G.Aframe * (4 * G.Scale_Factor): Oy%% = 0
Case Right
Ox%% = 14 * G.Scale_Factor - G.Aframe * (4 * G.Scale_Factor): Oy%% = 0
End Select
Select Case G.Aframe
Case 0
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 17 * (Link.Direction + 8), 137)-Step(15, 15)
Case 1
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 17 * (Link.Direction + 8), 137)-Step(15, 15)
_PutImage (Link.Screen_X + Ox%%, Link.Screen_Y + Oy%%)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 51 * Link.Weapon, 171 + 17 * Link.Direction)-Step(15, 15)
Case 2
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 34 * Link.Direction + 17, 137)-Step(15, 15)
_PutImage (Link.Screen_X + Ox%%, Link.Screen_Y + Oy%%)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 51 * Link.Weapon + 17, 171 + 17 * Link.Direction)-Step(15, 15)
Case 3
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 34 * Link.Direction + 0, 137)-Step(15, 15)
_PutImage (Link.Screen_X + Ox%%, Link.Screen_Y + Oy%%)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 51 * Link.Weapon + 34, 171 + 17 * Link.Direction)-Step(15, 15)
Case Else 'attack animation finished
G.Atime = 0: G.Aframe = 0: Link.Action = None
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 34 * Link.Direction + 17 * Frame%%, 137)-Step(15, 15)
End Select
_KeyClear
End Sub

Function Link_Collision%% (Dir%%)
Result%% = FALSE 'start at no collision
'get links center point x\y tile position to check for collision
Ax% = Link.World_X * 16 * (16 * G.Scale_Factor) 'gets the Left most pixel point for the current map screen
Ay% = Link.World_Y * 11 * (16 * G.Scale_Factor) 'gets the Top most pixel point for the current map screen
'we now have the tile that Links center pixel is in!
Select Case Dir%%
Case Up
Tx~%% = (Ax% + Link.Screen_X - Offset_X(G.Scale_Factor) + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent x-offset+50% sprite size
Ty%% = (Ay% + Link.Screen_Y - Offset_Y(G.Scale_Factor) - 2 + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent y-offset+50% sprite size
If Not Hyrule(Tx~%%, Ty%%).Walkable Then Result%% = TRUE
Case Down
Tx~%% = (Ax% + Link.Screen_X - Offset_X(G.Scale_Factor) + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent x-offset+50% sprite size
Ty%% = (2 + Ay% + Link.Screen_Y - Offset_Y(G.Scale_Factor) + 2 + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent y-offset+50% sprite size
If Not Hyrule(Tx~%%, Ty%%).Walkable Then Result%% = TRUE
Case Left
Tx~%% = (Ax% + Link.Screen_X - Offset_X(G.Scale_Factor) - 2 + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent x-offset+50% sprite size
Ty%% = (Ay% + Link.Screen_Y - Offset_Y(G.Scale_Factor) + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent y-offset+50% sprite size
If Not Hyrule(Tx~%%, Ty%%).Walkable Then Result%% = TRUE
Case Right
Tx~%% = (2 + Ax% + Link.Screen_X - Offset_X(G.Scale_Factor) + 2 + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent x-offset+50% sprite size
Ty%% = (Ay% + Link.Screen_Y - Offset_Y(G.Scale_Factor) + (16 * G.Scale_Factor \ 2)) \ 16 * G.Scale_Factor 'now add curent y-offset+50% sprite size
If Not Hyrule(Tx~%%, Ty%%).Walkable Then Result%% = TRUE
End Select
Link.Tile_X = Tx~%%
Link.Tile_Y = Ty%%
Link_Collision = Result%%
End Function

Sub Move_Link
Select Case Link.Direction
Case Up
If Not Link_Collision(Up) Then 'nothing blocking Link
If Link.Screen_Y > Offset_Y(G.Scale_Factor) Then 'Link is not at the edge of the screen
Link.Screen_Y = Link.Screen_Y - 2 * G.Scale_Factor
Else 'player is at edge of screen to shift to next one.
G.NextScreen = Up
Shift_New_Map_Screen
End If
End If
Case Down
If Not Link_Collision(Down) Then 'nothing blocking Link
If Link.Screen_Y < (Offset_Y(G.Scale_Factor) + (16 * G.Scale_Factor * 10)) Then 'Link is not at the edge of the screen
Link.Screen_Y = Link.Screen_Y + 2 * G.Scale_Factor
Else 'player is at edge of screen to shift to next one.
G.NextScreen = Down
Shift_New_Map_Screen
End If
End If
Case Left
If Not Link_Collision(Left) Then 'nothing blocking Link
If Link.Screen_X > Offset_X(G.Scale_Factor) Then 'Link is not at the edge of the screen
Link.Screen_X = Link.Screen_X - 2 * G.Scale_Factor
Else 'player is at edge of screen to shift to next one.
G.NextScreen = Left
Shift_New_Map_Screen
End If
End If
Case Right
If Not Link_Collision(Right) Then 'nothing blocking Link
If Link.Screen_X < (Offset_X(G.Scale_Factor) + (16 * G.Scale_Factor * 15)) Then 'Link is not at the edge of the screen
Link.Screen_X = Link.Screen_X + 2 * G.Scale_Factor
Else 'player is at edge of screen to shift to next one.
G.NextScreen = Right
Shift_New_Map_Screen
End If
End If
End Select
End Sub

Sub Move_Sword_Shot
Static Xloc As Integer, Yloc As Integer, Direction As _Byte, Fstp As _Byte, Frame As _Byte
If Direction = -1 Or Xloc = 0 Then 'if no direction assigned then assign one
Direction = Link.Direction
Xloc = Link.Screen_X
Yloc = Link.Screen_Y
End If
Select Case Direction
Case Up
Yloc = Yloc - 4 * G.Scale_Factor
Case Down
Yloc = Yloc + 4 * G.Scale_Factor
Case Left
Xloc = Xloc - 4 * G.Scale_Factor
Case Right
Xloc = Xloc + 4 * G.Scale_Factor
End Select
_PutImage (Xloc, Yloc)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 17 * Frame + 68 * Direction, 239)-Step(15, 15)
Select Case G.Scale_Factor
Case 1
If Xloc <= 272 Or Xloc >= 514 Or Yloc <= 212 Or Yloc >= 372 Then Done%% = TRUE
Case 2
If Xloc <= 140 Or Xloc >= 630 Or Yloc <= 100 Or Yloc >= 430 Then Done%% = TRUE
Case 3
If Xloc <= 16 Or Xloc >= 744 Or Yloc <= 96 Or Yloc >= 559 Then Done%% = TRUE
End Select
If Done%% Then Link.Shot = FALSE: G.Impactflag = TRUE: Impact Xloc, Yloc: Direction = -1: Remove_Projectile Sword, Player
Fstp = Fstp + 1
If Fstp = 2 Then Fstp = 0: Frame = Frame + 1
If Frame = 4 Then Frame = 0
End Sub

Sub Impact (X%, Y%)
Static Frame As _Byte, Fstp As _Byte, Xloc(3) As Integer, Yloc(3) As Integer
If Frame = -1 Or Xloc(2) = 0 Then
Fstp = 0
For i%% = 0 To 3: Xloc(i%%) = X% + 8 * G.Scale_Factor: Yloc(i%%) = Y% + 8 * G.Scale_Factor: Next i%%
End If
Xloc(0) = Xloc(0) - G.Scale_Factor: Yloc(0) = Yloc(0) - G.Scale_Factor
Xloc(1) = Xloc(1) + G.Scale_Factor: Yloc(1) = Yloc(1) - G.Scale_Factor
Xloc(2) = Xloc(2) + G.Scale_Factor: Yloc(2) = Yloc(2) + G.Scale_Factor
Xloc(3) = Xloc(3) - G.Scale_Factor: Yloc(3) = Yloc(3) + G.Scale_Factor
For i%% = 0 To 3
Select Case i%%
Case 0
_PutImage (Xloc(i%%) - 16, Yloc(i%%) - 16)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (205 + 17 * Frame, 205)-Step(15, 15)
Case 1
_PutImage (Xloc(i%%) + 16, Yloc(i%%) - 16)-Step(-G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (205 + 17 * Frame, 205)-Step(15, 15)
Case 2
_PutImage (Xloc(i%%) + 16, Yloc(i%%) + 16)-Step(-G.Scale_X, -G.Scale_Y), Layer(7), Layer(1), (205 + 17 * Frame, 205)-Step(15, 15)
Case 3
_PutImage (Xloc(i%%) - 16, Yloc(i%%) + 16)-Step(G.Scale_X, -G.Scale_Y), Layer(7), Layer(1), (205 + 17 * Frame, 205)-Step(15, 15)
End Select
Next i%%
Fstp = Fstp + 1
Frame = Frame + 1
If Frame = 4 Then Frame = 0
If Fstp = 16 Then Frame = -1: G.Impactflag = FALSE
End Sub

Sub Place_Link
Static Ftime As _Byte, Frame As _Byte
If Link.Action = Walking Then 'while Link is moving
G.Wtime = G.Wtime + 1 'Increment frame time
If G.Wtime = 8 Then
If G.Wframe Then G.Wframe = 0 Else G.Wframe = 1 'change frame
G.Wtime = 0 'reset frame time
End If
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 34 * Link.Direction + 17 * G.Wframe, 137)-Step(15, 15)
ElseIf Link.Action = Useing Then 'when Link uses an item
Ftime = Ftime + 1 'Increment frame time
If Ftime = 32 Then Link.Action = None: Ftime = 0 'action is done
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 17 * (Link.Direction + 8), 137)-Step(15, 15)
ElseIf Link.Action = GetItem Then 'When Link gets a sword\item or buys something
'Held while music plays
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 17 * 12, 137)-Step(15, 15)
ElseIf Link.Action = GetTriforce Then 'When Link recovers a Triforce piece
'Held while music plays
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 17 * 13, 137)-Step(15, 15)
ElseIf Link.Action = Attack Then
G.Atime = G.Atime + 1 'Increment frame time
If G.Atime = 4 Then G.Aframe = G.Aframe + 1: G.Atime = 0 'change frame:reset frame time
Link_Attack
Else 'Link is standing Still(Action=None)
G.Atime = 0: G.Aframe = 0
G.Wtime = 0: G.Wframe = 0
_PutImage (Link.Screen_X, Link.Screen_Y)-Step(G.Scale_X, G.Scale_Y), Layer(7), Layer(1), (1 + 34 * Link.Direction + 17 * Frame%%, 137)-Step(15, 15)
End If
End Sub

Sub Place_Player_Record (I%%, Where%)
Select Case Where%
Case 0
If Records(I%% + 1).Beaten Then _PutImage (260, 228 + 48 * I%%)-Step(15, 31), Layer(12), Layer(16), (64, 247)-Step(7, 15) 'Player 1 Sword
_PutImage (236, 234 + 48 * I%%)-Step(31, 31), Layer(12), Layer(16), (1 + 17 * Records(I%% + 1).Ring, 230)-Step(15, 15) 'Player 1 Link (green)
_PrintString (284, 232 + 48 * I%%), RTrim$(Nick(I%% + 1)), Layer(16) 'player 1 name
_PrintString (284, 248 + 48 * I%%), Left$(" ", 3 - Len(LTrim$(RTrim$(Str$(Records(I%% + 1).Played))))) + LTrim$(Str$(Records(I%% + 1).Played)), Layer(16) 'player 1 tries
For j%% = 1 To Records(I%% + 1).Containers
If j%% < 4 Then 'first 3 hearts are red
_PutImage (428 + 16 * j%%, 232 + 48 * I%%)-Step(15, 15), Layer(12), Layer(16), (52, 230)-Step(7, 7) 'Player 1 hearts red
Else
If j%% < 9 Then
_PutImage (428 + 16 * j%%, 232 + 48 * I%%)-Step(15, 15), Layer(12), Layer(16), (73, 267)-Step(7, 7) 'Player 1 hearts white
Else
_PutImage (428 + 16 * (j%% - 8), 232 + 64 * I%%)-Step(15, 15), Layer(12), Layer(16), (73, 267)-Step(7, 7) 'Player 1 hearts white
End If
End If
Next j%%
Case 1
If Records(I%% + 1).Beaten Then _PutImage (326, 148 + 48 * (I%% - 1))-Step(15, 31), Layer(12), Layer(16), (64, 247)-Step(7, 15) 'Player 1 Sword
_PutImage (300, 154 + 48 * (I%%))-Step(31, 31), Layer(12), Layer(16), (1 + 17 * Records(I%% + 1).Ring, 230)-Step(15, 15) 'Player 1 Link (green)
_PrintString (364, 152 + 48 * (I%%)), RTrim$(Nick(I%% + 1)), Layer(1)

End Select
End Sub

Sub Place_Tile_On_Screen (X%, Y%, Tile~%%, L&)
Gy% = 17 * (Tile~%% \ 20) 'get which row it comes from
Gx% = 17 * (Tile~%% Mod 20) 'which column position
_PutImage (Offset_X(G.Scale_Factor) + X%, Offset_Y(G.Scale_Factor) + Y%)-Step(G.Scale_X, G.Scale_Y), Layer(7), L&, (1 + Gx%, 1 + Gy%)-Step(15, 15)
End Sub

Sub Scroll_Screen_II (Dir%%)
Cx% = Offset_X(G.Scale_Factor) 'top left corner location of map displayed
Cy% = Offset_Y(G.Scale_Factor)
Sfx% = 16 * 16 * G.Scale_Factor 'size of the map display
Sfy% = 11 * 16 * G.Scale_Factor
Lwx% = 16 * 16 * G.Scale_Factor * Link.World_X 'map area link is in
Lwy% = 11 * 16 * G.Scale_Factor * Link.World_Y
Select Case Dir%%
Case Up
For y% = 0 To Sfy% Step 2 * G.Scale_Factor
_PutImage (Cx%, Cy%)-Step(Sfx%, Sfy%), Layer(6), Layer(1), (Lwx%, Lwy% - y%)-Step(Sfx%, Sfy%)
If y% > 16 * G.Scale_Factor Then Link.Screen_Y = Link.Screen_Y + 2 * G.Scale_Factor
Place_Link
_Limit 60
_PutImage , Layer(1), Layer(0)
Next
Link.World_Y = Link.World_Y - 1
Case Down
For y% = 0 To Sfy% Step 2 * G.Scale_Factor
_PutImage (Cx%, Cy%)-Step(Sfx%, Sfy%), Layer(6), Layer(1), (Lwx%, Lwy% + y%)-Step(Sfx%, Sfy%)
If y% > 16 * G.Scale_Factor Then Link.Screen_Y = Link.Screen_Y - 2 * G.Scale_Factor
Place_Link
_Limit 60
_PutImage , Layer(1), Layer(0)
Next
Link.World_Y = Link.World_Y + 1
Case Left
For x% = 0 To Sfx% Step 2 * G.Scale_Factor
_PutImage (Cx%, Cy%)-Step(Sfx%, Sfy%), Layer(6), Layer(1), (Lwx% - x%, Lwy%)-Step(Sfx%, Sfy%)
If x% > 16 * G.Scale_Factor Then Link.Screen_X = Link.Screen_X + 2 * G.Scale_Factor
Place_Link
_Limit 60
_PutImage , Layer(1), Layer(0)
Next
Link.World_X = Link.World_X - 1
Case Right
For x% = 0 To Sfx% Step 2 * G.Scale_Factor
_PutImage (Cx%, Cy%)-Step(Sfx%, Sfy%), Layer(6), Layer(1), (Lwx% + x%, Lwy%)-Step(Sfx%, Sfy%)
If x% > 16 * G.Scale_Factor Then Link.Screen_X = Link.Screen_X - 2 * G.Scale_Factor
Place_Link
_Limit 60
_PutImage , Layer(1), Layer(0)
Next
Link.World_X = Link.World_X + 1
End Select
Place_Link
Lwx% = 16 * 16 * G.Scale_Factor * Link.World_X
Lwy% = 11 * 16 * G.Scale_Factor * Link.World_Y
_PutImage (Cx%, Cy%)-Step(Sfx%, Sfy%), Layer(6), Layer(3), (Lwx%, Lwy%)-Step(Sfx%, Sfy%) 'move new screen to layer(3)
End Sub

Sub Shift_New_Map_Screen
Select Case G.NextScreen
Case Up
Scroll_Screen_II Up
Case Down
Scroll_Screen_II Down
Case Left
Scroll_Screen_II Left
Case Right
Scroll_Screen_II Right
End Select
G.NextScreen = -1
End Sub

Sub Title_Screen
_ClearColor _RGB32(21), Layer(9)
_ClearColor _RGB32(21), Layer(10)
_SndVol BGM(0), .33
_SndLoop BGM(0)
Do
F%% = 0: F% = 0: ExitFlag%% = FALSE
Do: _Limit 60: Loop While _SndGetPos(BGM(0)) > 10
Do
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (0, 0)-Step(255, 223)
Select Case F%%
Case 12 To 18
_PutImage (400 - 74, 300 - 128)-Step(143, 143), Layer(9), Layer(1), (289, 0)-Step(71, 71)
Case 19 To 24
_PutImage (400 - 74, 300 - 128)-Step(143, 143), Layer(9), Layer(1), (289, 0 + 72)-Step(71, 71)
Case 25 To 36
_PutImage (400 - 74, 300 - 128)-Step(143, 143), Layer(9), Layer(1), (289, 0 + 144)-Step(71, 71)
Case 37 To 52
_PutImage (400 - 74, 300 - 128)-Step(143, 143), Layer(9), Layer(1), (289, 0 + 72)-Step(71, 71)
Case 53 To 59
_PutImage (400 - 74, 300 - 128)-Step(143, 143), Layer(9), Layer(1), (289, 0 + 0)-Step(71, 71)
End Select
_PutImage (304, 523 - 112), Layer(10), Layer(1), (0 + 64 * wave%%, 0)-Step(63, 111)
_PutImage , Layer(1), Layer(0)
_Limit 90
F%% = F%% + 1
If F%% = 60 Then F%% = 0
If F%% Mod 2 = 0 Then wave%% = wave%% + 1
If wave%% = 16 Then wave%% = 0
If Get_Input = START_BUTTON Then ExitFlag%% = TRUE
Loop Until _SndGetPos(BGM(0)) > 8.4 Or ExitFlag%%

If Not ExitFlag%% Then
'start the title fade
_Dest Layer(1)
F%% = 0
Do
Select Case F%
Case 0 To 13
Line (144, 76)-Step(511, 447), _RGB32(202, 241, 159), BF
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (361, 0)-Step(255, 223)
Case 13 To 24
Line (144, 76)-Step(511, 447), _RGB32(182, 216, 255), BF
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (361, 0)-Step(255, 223)
Case 25 To 34
Line (144, 76)-Step(511, 447), _RGB32(166, 229, 255), BF
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (361, 0)-Step(255, 223)
Case 35 To 42
Line (144, 76)-Step(511, 447), _RGB32(165, 238, 223), BF
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (617, 0)-Step(255, 223)
Case 43 To 48
Line (144, 76)-Step(511, 447), _RGB32(37, 190, 255), BF
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (617, 0)-Step(255, 223)
Case 49 To 52
Line (144, 76)-Step(511, 447), _RGB32(0, 109, 181), BF
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (617, 0)-Step(255, 223)
Case 53 To 57
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (873, 0)-Step(255, 223)
Wf% = 112
Case 58 To 61
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (1129, 0)-Step(255, 223)
Wf% = 224
Case 62 To 363
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (1385, 0)-Step(255, 223)
Wf% = 336
Case 364 To 385
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (1641, 0)-Step(255, 223)
Wf% = 448
Case 386 To 393
_PutImage ((800 - 512) \ 2, (600 - 448) \ 2)-Step(511, 447), Layer(9), Layer(1), (1897, 0)-Step(255, 223)
Wf% = 560
End Select
_PutImage (304, 523 - 112), Layer(10), Layer(1), (0 + 64 * wave%%, 0 + Wf%)-Step(63, 111)
_PutImage , Layer(1), Layer(0)
_Limit 90
F% = F% + 1
If F% = 394 Then ExitFlag%% = TRUE
If F% Mod 2 = 0 Then wave%% = wave%% + 1
If wave%% = 16 Then wave%% = 0
If Get_Input = START_BUTTON Then ExitFlag%% = TRUE
Loop Until ExitFlag%%
ExitFlag%% = FALSE
End If
ClearLayer Layer(0)
ClearLayer Layer(1)
If Not ExitFlag%% Then
'Title scroll
Do: _Limit 60: If Get_Input = START_BUTTON Then ExitFlag%% = TRUE
Loop Until _SndGetPos(BGM(0)) > 16 Or ExitFlag%%
F% = 0
If Not ExitFlag%% Then
Do
Select Case F%
Case 0 To 223
_PutImage (144, 76)-Step(511, 447), Layer(11), Layer(1), (0, -223 + F%)-Step(255, 223)
Case Is >= 354
If blink% Then
_PutImage (72, 332)-Step(7, 15), Layer(7), Layer(11), (247, 154)-Step(7, 15) 'heart
_PutImage (72, 464)-Step(7, 15), Layer(7), Layer(11), (213, 171)-Step(7, 15) 'Ruby
_PutImage (120, 1432)-Step(15, 15), Layer(7), Layer(11), (239, 188)-Step(15, 15) 'Triforce
Else
_PutImage (72, 332)-Step(7, 15), Layer(7), Layer(11), (239, 154)-Step(7, 15) 'heart
_PutImage (72, 464)-Step(7, 15), Layer(7), Layer(11), (205, 171)-Step(7, 15) 'Ruby
_PutImage (120, 1432)-Step(15, 15), Layer(7), Layer(11), (222, 188)-Step(15, 15) 'Triforce
End If
If Fblink% Then
_PutImage (72, 400)-Step(7, 15), Layer(7), Layer(11), (256, 188)-Step(7, 15) 'fairy blank
_PutImage (72, 400)-Step(7, 15), Layer(7), Layer(11), (281, 154)-Step(7, 15) 'fairy
Else
_PutImage (72, 400)-Step(7, 15), Layer(7), Layer(11), (256, 188)-Step(7, 15) 'fairy blank
_PutImage (72, 400)-Step(7, 15), Layer(7), Layer(11), (273, 154)-Step(7, 15) 'fairy
End If
_PutImage (144, 76)-Step(511, 447), Layer(11), Layer(1), (0, F% - 354)-Step(255, 223)
End Select
_PutImage , Layer(1), Layer(0)
_Limit 30
F% = F% + 1
If F% = 1762 Then F% = F% - 1 'ExitFlag%% = TRUE
B% = B% + 1
If B% = 4 Then blink% = Not blink%: B% = 0
If B% Mod 2 = 0 Then Fblink% = Not Fblink%
If Get_Input = START_BUTTON Then ExitFlag%% = TRUE
Loop Until _SndGetPos(BGM(0)) >= 79.75 Or ExitFlag%%
ExitFlag%% = FALSE
End If
End If

Loop Until ExitFlag%%
_Dest Layer(0)
_SndStop BGM(0)
Do: Loop Until Get_Input%% = -1

End Sub

Function Projectile_Collision%%
Result%% = FALSE
For i%% = 0 To G.Projectile_Count
Next
Projectile_Collision = Result%%
End Function

Sub Select_Screen
ClearLayer Layer(16)
If _FileExists("Zelda.MSF") Then 'load saved data
Open "Zelda.MSF" For Binary As #1
For I%% = 1 To 3 'load all 3 records
Get #1, , Nick(I%%)
Get #1, , Records(I%%)
If Selection%% = 0 Then If RTrim$(Nick(I%%)) <> "" Then Selection%% = I%%
Next I%%
Close #1
Else 'file doesn't exist so make it.
Reset_Record 1
Reset_Record 2
Reset_Record 3
Save_Records
End If
_PutImage (140, 72)-Step(511, 447), Layer(12), Layer(16), (1, 1)-Step(255, 223) 'background
For I%% = 1 To 3
If RTrim$(Nick(I%%)) <> "" Then Place_Player_Record I%% - 1, 0
Next I%%
If Record_Count%% = 0 Then Selection%% = 4 Else Selection%% = 1
Selection%% = Find_First_Available(0, 1)
Do
_PutImage , Layer(16), Layer(1)
Select Case Get_Input%%
Case START_BUTTON
Select Case Selection%%
Case 1 To 3
Link = Records(Selection%%)
Exitflag%% = TRUE
Case 4
Do: Loop Until Get_Input%% = -1
nul%% = Register(nul%%)
Open "Zelda.MSF" For Binary As #1 'update records
For I%% = 1 To 3
Put #1, , Nick(I%%)
Put #1, , Link
If RTrim$(Nick(I%%)) <> "" Then Place_Player_Record I%% - 1, 0
Next I%%
Close #1
Case 5
Do: Loop Until Get_Input%% = -1
Elimination_Mode
nul%% = Register(nul%%) 'go straight to register mode after elimination
End Select
Case SELECT_BUTTON
Selection%% = Selection%% + 1
If Selection%% = 6 Then Selection%% = 1
Selection%% = Find_First_Available(0, Selection%%)
Do: Loop Until Get_Input%% = -1
Case Else
_PrintString (0, 20), Str$(SELECT_BUTTON), Layer(1)
End Select

Select Case Selection%%
Case 1
_PutImage (220, 242)-Step(15, 15), Layer(12), Layer(1), (73, 247)-Step(7, 7) 'Player 1
Case 2
_PutImage (220, 290)-Step(15, 15), Layer(12), Layer(1), (73, 247)-Step(7, 7) 'Player 2
Case 3
_PutImage (220, 338)-Step(15, 15), Layer(12), Layer(1), (73, 247)-Step(7, 7) 'Player 3
Case 4
_PutImage (220, 394)-Step(15, 15), Layer(12), Layer(1), (73, 247)-Step(7, 7) 'register
Case 5
_PutImage (220, 426)-Step(15, 15), Layer(12), Layer(1), (73, 247)-Step(7, 7) 'Elimination
End Select
_PrintString (0, 0), Str$(Selection%%), Layer(1)
_PutImage , Layer(1), Layer(0)
_Limit 60
If InKey$ = Chr$(27) Then Exitflag%% = TRUE
Loop Until Exitflag%%
End Sub

Function Register%% (Records%%)
Dim Names(2, 8) As String * 1
Result%% = Records%%
Tmp& = _CopyImage(Layer(16))
ClearLayer Layer(16)
ClearLayer Layer(1)
_PutImage (140, 72)-Step(511, 447), Layer(12), Layer(16), (258, 1)-Step(255, 223) 'background
For i%% = 1 To 3
If RTrim$(Nick(i%%)) <> "" Then Place_Player_Record i%% - 1, 1
Next i%%
If i%% > 0 Then Selection%% = i%% Else Selection%% = 1
For i%% = 1 To 3
If RTrim$(Nick(i%%)) = "" Then _PutImage (300, 154 + 48 * (i%% - 1))-Step(31, 31), Layer(12), Layer(16), (1, 230)-Step(15, 15) 'Player 1 Link (green)
Next i%%
_ClearColor _RGB32(0), Layer(16)
_PutImage , Layer(16), Layer(1)
_Dest Layer(1)
_PrintMode _KeepBackground , Layer(1)
Current_Letter%% = 1
Selection%% = Find_First_Available(1, 1)
Do

Select Case Get_Input%%
Case Up
_PutImage (236 + 32 * Lx%, 328 + 32 * Ly%)-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current selected Letter
Ly% = Ly% - 1
If Ly% = -1 Then Ly% = 3
Current_Letter%% = Current_Letter%% - 11
If Current_Letter%% < 0 Then Current_Letter%% = 44 - Abs(Current_Letter%%)
Case Down
_PutImage (236 + 32 * Lx%, 328 + 32 * Ly%)-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current selected Letter
Ly% = Ly% + 1
If Ly% = 4 Then Ly% = 0
Current_Letter%% = Current_Letter%% + 11
If Current_Letter%% > 44 Then Current_Letter%% = Current_Letter%% - 44
Case Left
_PutImage (236 + 32 * Lx%, 328 + 32 * Ly%)-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current selected Letter
Lx% = Lx% - 1
If Lx% = -1 Then Lx% = 10: Ly% = Ly% - 1: If Ly% = -1 Then Ly% = 3
Current_Letter%% = Current_Letter%% - 1
If Current_Letter%% = 0 Then Current_Letter%% = 44
Case Right
_PutImage (236 + 32 * Lx%, 328 + 32 * Ly%)-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current selected Letter
Lx% = Lx% + 1
If Lx% = 11 Then Lx% = 0: Ly% = Ly% + 1: If Ly% = 4 Then Ly% = 0
Current_Letter%% = Current_Letter%% + 1
If Current_Letter%% = 45 Then Current_Letter%% = 1
Case BUTTON_A Or BUTTON_B
If Selection%% <> 4 Then 'only allow buttons if valid name entry selection
_PutImage (364 + 16 * Length%%, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current Nick Letter
Names(Selection%% - 1, Length%%) = Letter(Current_Letter%%)
Length%% = Length%% + 1
If Length%% = 8 Then Length%% = 0
End If
Case START_BUTTON
Select Case Selection%%
Case 4 'end
For j%% = 0 To 2
a$ = ""
If RTrim$(Nick(j%% + 1)) = "" Then
For i%% = 0 To 7
If Asc(Names(j%%, i%%)) > 31 Then a$ = a$ + Names(j%%, i%%)
Next
Nick(j%% + 1) = a$
End If
Next
ExitFlag%% = TRUE
End Select
Case SELECT_BUTTON 'Change to different name or end registration
_PutImage (364 + 16 * Length%%, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current Nick Letter
_PutImage (274, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'heart selection
Selection%% = Selection%% + 1: Length%% = 0 'reset the name position when changing.
If Selection%% = 5 Then Selection%% = 1
_PrintString (0, 0), Str$(Selection%%), Layer(1)
Selection%% = Find_First_Available(1, Selection%%)
Case Else
Line (0, 0)-Step(160, 40), _RGB32(0), BF
_PrintString (0, 20), Str$(Selection%%), Layer(1)
End Select
Do: Loop Until Get_Input%% = -1

_PutImage (274, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (73, 247)-Step(7, 7) 'heart selection
If Selection%% <> 4 Then
For j%% = 0 To 8
If Names(Selection%% - 1, j%%) > Chr$(31) Then _PrintString (364 + 16 * j%%, 152 + 48 * (Selection%% - 1)), Names(Selection%% - 1, j%%), Layer(1)
Next j%%
End If
_PutImage , Layer(1), Layer(0)
If blink%% And Selection%% <> 4 Then
_PutImage (364 + 16 * Length%%, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (61, 230)-Step(7, 7) 'Current Nick Letter
_PutImage (236 + 32 * Lx%, 328 + 32 * Ly%)-Step(15, 15), Layer(12), Layer(1), (61, 230)-Step(7, 7) 'Current selected Letter
Else
_PutImage (364 + 16 * Length%%, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current Nick Letter
_PutImage (236 + 32 * Lx%, 328 + 32 * Ly%)-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'Current selected Letter
End If
_PutImage , Layer(16), Layer(1)
b%% = b%% + 1
If b%% = 8 Then blink%% = Not blink%%: b%% = 0
_Limit 60
If InKey$ = Chr$(27) Then ExitFlag%% = TRUE
Loop Until ExitFlag%%
ClearLayer Layer(16)
_PutImage , Tmp&, Layer(16)
_FreeImage Tmp&
Save_Records
For i%% = 1 To 3
If RTrim$(Nick(i%%)) <> "" Then Place_Player_Record i%% - 1, 0
Next i%%
Register = Result%%
End Function

Sub Elimination_Mode
Tmp& = _CopyImage(Layer(16))
ClearLayer Layer(16)
ClearLayer Layer(1)
_PutImage (140, 72)-Step(511, 447), Layer(12), Layer(16), (515, 1)-Step(255, 223) 'background
For i%% = 1 To 3
If RTrim$(Nick(i%%)) <> "" Then Place_Player_Record i%% - 1, 1
Next i%%
_PutImage , Layer(16), Layer(0)
If i%% > 0 Then Selection%% = i%% Else Selection%% = 1
For i%% = 1 To 3 'remove the erased game from the background screens
If RTrim$(Nick(i%%)) = "" Then _PutImage (300, 154 + 48 * (i%% - 1))-Step(31, 31), Layer(12), Layer(16), (1, 230)-Step(15, 15) 'Player 1 Link (green)
Next i%%
_ClearColor _RGB32(0), Layer(16)
_PutImage , Layer(16), Layer(1)
_Dest Layer(1)
_PrintMode _KeepBackground , Layer(1)
Current_Letter%% = 1
Selection%% = 1
Do
_PutImage , Layer(16), Layer(1)
Select Case Get_Input%%
Case START_BUTTON
Select Case Selection%%
Case 1 To 3
Nick(Selection%%) = ""
Reset_Record Selection%%
_PutImage (364, 152 + 48 * (Selection%% - 1))-Step(159, 31), Layer(12), Layer(16), (86, 240)-Step(7, 7) 'black out
_PutImage (236, 232 + 48 * (Selection%% - 1))-Step(159, 33), Layer(12), Tmp&, (86, 240)-Step(7, 7) 'black out name
_PutImage (428, 232 + 48 * (Selection%% - 1))-Step(127, 31), Layer(12), Tmp&, (86, 240)-Step(7, 7) 'black out hearts
Case 4
ExitFlag%% = TRUE
End Select
Case SELECT_BUTTON
_PutImage (274, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (86, 240)-Step(7, 7) 'heart selection black out
Selection%% = Selection%% + 1
If Selection%% = 5 Then Selection%% = 1
Case Else
_PrintString (0, 20), Str$(SELECT_BUTTON), Layer(1)
End Select
Do: Loop Until Get_Input%% = -1
_PutImage (274, 152 + 48 * (Selection%% - 1))-Step(15, 15), Layer(12), Layer(1), (73, 267)-Step(7, 7) 'heart selection
_PutImage , Layer(1), Layer(0)
_Limit 60
If InKey$ = Chr$(27) Then ExitFlag%% = TRUE
Loop Until ExitFlag%%
ClearLayer Layer(16)
_PutImage , Tmp&, Layer(16)
_FreeImage Tmp&
End Sub

Sub Reset_Record (Which%%)
Records(Which%%) = Reset_Link
End Sub

Sub Save_Records
Open "Zelda.MSF" For Binary As #1
For I%% = 1 To 3
Put #1, , Nick(I%%)
Put #1, , Records(I%%)
Next I%%
Close #1
End Sub

Sub MFI_Loader (FN$)
Dim Size(128) As Long, FOffset(128) As Long
Open FN$ For Binary As #1
Get #1, , c~%% 'retrieve number of files
For I~%% = 1 To c~%%
Get #1, , FOffset(I~%%)
Get #1, , Size(I~%%)
FOffset&(I~%%) = FOffset&(I~%%) + 1
Next I~%%
Layer(7) = LoadGFX(FOffset(1), Size(1)) '_LOADIMAGE("overworldtiles.bmp", 32)
Layer(9) = LoadGFX(FOffset(2), Size(2)) '_LOADIMAGE("TitleScreen.bmp", 32)
Layer(10) = LoadGFX(FOffset(3), Size(3)) '_LOADIMAGE("Titlefalls.bmp", 32)
Layer(11) = LoadGFX(FOffset(4), Size(4)) '_LOADIMAGE("Titlescroll.bmp", 32)
Layer(12) = LoadGFX(FOffset(5), Size(5)) '_LOADIMAGE("selectionscreen.bmp", 32)

SFX(0) = LoadSFX(FOffset(6), Size(6))
SFX(1) = LoadSFX(FOffset(7), Size(7))
SFX(2) = LoadSFX(FOffset(8), Size(8))
SFX(3) = LoadSFX(FOffset(9), Size(9))
BGM(0) = LoadSFX(FOffset(10), Size(10))
FFX(0) = LoadFFX(FOffset(11), Size(11), 16)
LoadData FOffset(12), Size(12)

Close #1
If _FileExists("temp.dat") Then Kill "temp.dat"
End Sub

Function LoadGFX& (Foff&, Size&)
If _FileExists("temp.dat") Then Kill "temp.dat"
Open "temp.dat" For Binary As #3
dat$ = Space$(Size&)
Get #1, Foff&, dat$
Put #3, , dat$
Close #3
LoadGFX& = _LoadImage("temp.dat", 32)
End Function

Function LoadFFX& (Foff&, Size&, Fize%%)
If _FileExists("temp.dat") Then Kill "temp.dat"
Open "temp.dat" For Binary As #3
dat$ = Space$(Size&)
Get #1, Foff&, dat$
Put #3, , dat$
Close #3
LoadFFX& = _LoadFont("temp.dat", Fize%%, "monospace")
End Function

Function LoadSFX& (Foff&, Size&)
If _FileExists("temp.dat") Then Kill "temp.dat"
Open "temp.dat" For Binary As #3
dat$ = Space$(Size&)
Get #1, Foff&, dat$
Put #3, , dat$
Close #3
LoadSFX& = _SndOpen("temp.dat")
End Function

Sub LoadData (Foff&, Size&)
If _FileExists("temp.dat") Then Kill "temp.dat"
Open "temp.dat" For Binary As #3
dat$ = Space$(Size&)
Get #1, Foff&, dat$
Put #3, , dat$
Close #3

F1 = FreeFile
Open "temp.dat" For Binary As #F1
Get #F1, , Hyrule()
Get #F1, , Link
Get #F1, , C
Get #F1, , G
Get #F1, , Offset_X()
Get #F1, , Offset_Y()
For I%% = 1 To 44
Get #F1, , Letter(I%%)
Next I%%
Close #F1

End Sub


.mfi   Zelda.MFI (Size: 1.74 MB / Downloads: 67)

Print this item

  Eigenstate Board Game
Posted by: SMcNeill - 12-23-2023, 01:18 PM - Forum: Donald Foster - No Replies

Hello Everyone,

Eigenstate is a 2 player abstract strategy board game. The game is played on a 6 X 6 checkered like game board, although the light and dark squares have no importance in the game.

Each player has each 6 identical pieces, player 1 with 6 dark pieces and player 2 with 6 light pieces. The pieces are placed on their back row respectively. There is a red dot in the center of each piece representing current position in relationship to directions and number of spaces it can move. Don’t confuse this with it’s actual location on the board. There are 24 holes in the piece surrounding the center red position on each piece. These holes when filled with a peg denotes positions on the board this piece can move in future moves in relation to where it currently located. At the start of the game, player 1, who is moving up the board from its starting location, has a peg in the position 1 up from the red center already installed. This means that piece can only move forward up the board 1 space. Whereas player 2 has a peg installed on the lower side of the peg indicating it can only move downward 1 space. As play continues, each player will be placing more pegs onto their pieces to add more choices of direction and distance a piece can move on future moves. Each player is in direct control of how a piece can move in future moves. Also, each piece can move like a Knight in Chess in the sense that it can jump over other pieces and can not be blocked. We will discuss when and how pegs are added to pieces shortly.

Each player’s turn consists of 2 moves: First a player chooses 1 of their pieces and moves it to any playable location on the board from their position according to the directions and distances from the center red dot. If no legal moves are possible, then that portion of their turn omitted. Then they make their Second move by placing 2 pegs on any of their pieces on the board. The 2 pegs be placed on the same piece if wished or on 2 separate pieces. Then their turn ends and goes to the next player.

When a piece lands on another pieces, during the first part of the move, that piece is captured and removed from the board including player’s own piece if captured.

The game ends and a winner is declared in 1 of 2 situations: If you reduce you opponent down to 1 piece, you win. Or if both players has exactly 2 pieces left each and you have filled all 24 holes with pegs on 1 of your pieces, you win.

Computer Game Play:
At the start of your turn, you’ll see on the right side of the screen your piece indictor representing your turn. You are asked to choose a piece to move. Left click on the piece you wish to move. A red cursor will surround that piece indicating it has been selected. Other black cursor(s) will appear on the board indicating where your legal moves are. If you change your mind and want to move a different piece, left click on the same piece and it will be deselected. When clicking on 1 of the playable locations, your piece will move to that new location. If during this turn you have no playable pieces, there will be a message displayed “You have no Playable Moves”, “Press <ENTER> to Continue”. Next, you are asked to choose a piece to place a peg and also mentions that you are placing the first peg. Left click on the piece you wish to place a peg on. A larger copy of the piece chose will be drawn on the right side of the board. You are asked to choose an empty peg hole to place a peg. Left click on the empty hole and the enlarged piece will be removed and a peg will be added to the chosen piece. Then you are asked to choose the second piece to add a peg. You can pick the same piece again or choose a different piece. After placing the second peg, the turn passes to the other player until there is a winner.

This game summery can be downloaded and printed as a reference.

Hope you enjoy playing
Donald

   


.7z   Eigenstate Board Game.7z (Size: 251.1 KB / Downloads: 40)

Print this item

  Dragon Warrior by Cobalt
Posted by: SMcNeill - 12-23-2023, 01:10 PM - Forum: Games - Replies (9)

Dragon Warrior 64

Author: @Cobalt
Source: qb64.org Forum (Archive)
URL: https://qb64forum.alephc.xyz/index.php?t...#msg118980
Version: 2021-08-26 (as Author's QB64 Forum post above)
Tags: [RPG], [Graphics], [Audio]

Description:
QB64 version of Nintendo Dragon Quest (Dragon Warrior).  The time has come to go on your quest to find and defeat the evil DragonLord.  I hope that you have fun playing this game.

DEFAULT Controls:
It does have a better feel when playing with a Joypad but it is not required.
Start button = A (upper case)
A Button = Space bar (accept selection)
B Button = Enter (cancel action\ selection)
Arrow keys for movement


[Image: index.php?action=dlattach;topic=2695.0;attach=6272]


[Image: index.php?action=dlattach;topic=2695.0;attach=6274]

[Image: index.php?action=dlattach;topic=2695.0;attach=6276]

Zip Archive HERE:
.zip   Dragon Warrior 2024-12-03.zip (Size: 10.88 MB / Downloads: 47)



Attached Files
.zip   Dragon Warrior 2021-08-26.zip (Size: 9.19 MB / Downloads: 96)
Print this item

  Lucky Numbers Board Game
Posted by: SMcNeill - 12-23-2023, 12:58 PM - Forum: Donald Foster - Replies (2)

[Image: index.php?action=dlattach;topic=4327.0;attach=14585]


Hello Everyone,

Lucky Numbers is a 2 to 4 strategy board game played with individual boards and decks of cards based on the number of players. There is a solo play version, however, I did not not include it here. Each board has spaces 4 across by 4 down to hold numbered cards. Each deck of cards are numbered from 1 to 20 and there is a deck of cards for each number of players. In example: 2 decks of cards for 2 players, 3 decks of cards for 3 players and 4 decks of cards for 4 players. The object of the game is to be the first player to completely fill your board with the numbered cards.

The game starts with each player has a n empty gameboard in front of them. All the decks of cards are shuffled together. There are 4 starting cards placed on each gameboard at the start of the game that are randomly drawn from the deck. The cards are placed in ascending order from the lowest place in the upper left corner position 1:1, the next lowest placed at position 2:2, then the next lowest at position 3:3 and the highest card place at the lower right corner position 4:4. There's an optional version, known as Michael's Version, where only one card is reveled at a time and each player places that card at one of the 4 starting locations they feel is the best spot for that card without looking at any of the face down cards. Then the player turns over the next card in the same manner until all 4 cards are placed in the 4 starting positions.

Cards can only be placed on the board in ascending order from top to bottom and from left to right with the lowest in the upper left corner to the highest in the lower tight corner and no 2 cards with the same number may be next to each other, up and down or side by side. A player may choose to draw a face down card off the top of the deck or play a face up card discarded face up on the table. Once a player draws a face down card from the deck, they stuck with card and can not play a card from the table. If the card drawn from the deck is playable, they may play it on their board or place it on to the table. You may also replace a card on your board with the card you drew from the deck or from the table if it is playable in that spot. The card you removed from your board goes to the table.

The sequence of play: You will be asked number of players, use keyboard for input. Then it will ask to use Michael's Variation, again keyboard input. There will be a thick cursor around the game board board of the player currently taking their turn. At the start of the game, that will be player 1. There is a cursor around the deck of cards indicating thru van draw a card from the deck. The card will appear next to the deck. If there are any cards on the table, there will be a cursor around the the group. To choose a card from the table, click anywhere inside the table cursor, the click on the card you wish to play. A cursor will surround only that card. You van play this card onto your board by clicking the spot on the board or you can select a different table card by re-clicking the card you selected and choose a different or draw a card from the deck.

I've included 2 different copies copies of the rules.

Hope you enjoy playing, Donald


Code: (Select All)
_Title "Lucky Numbers - Coded by Donald L. Foster Jr."

Screen _NewImage(1035, 735, 256)

Randomize Timer

_PaletteColor 1, _RGB32(0, 0, 90) ' Blue Playing Board
_PaletteColor 2, _RGB32(0, 155, 155) ' Cyan Board Spacer
_PaletteColor 3, _RGB32(235, 195, 0) ' Gold Card
_PaletteColor 4, _RGB32(50, 185, 30) ' Green Card
_PaletteColor 5, _RGB32(32, 110, 170) ' Blue Card
_PaletteColor 6, _RGB32(138, 43, 226) ' Purple Card

Dim R As Integer
Dim S As Integer
Dim T As Integer
Dim U As Integer
Dim V As Integer
Dim W As Integer
Dim X As Integer
Dim Y As Integer
Dim Z As Integer

Dim X1 As Integer
Dim X2 As Integer
Dim X3 As Integer
Dim X4 As Integer

Dim Player As Integer
Dim Players As Integer
Dim Row As Integer
Dim Column As Integer
Dim Winner As Integer
Dim Card As Integer
Dim CardColor As Integer
Dim Board As Integer
Dim Variation As Integer
Dim DeckCards As Integer
Dim TableCards As Integer
Dim PlayCard As Integer
Dim PlayColor As Integer
Dim OldCard As Integer
Dim OldColor As Integer
Dim LowCard As Integer
Dim Occupied As Integer
Dim CanPlay As Integer
Dim DrawPile As Integer
Dim Table As Integer
Dim Position As Integer
Dim Routine As Integer

Dim DeckColor(80) As Integer
Dim DeckCard(80) As Integer
Dim CardColor(5) As Integer
Dim Placed(80) As Integer
Dim BoardCenterX(5) As Integer
Dim BoardCenterY(5) As Integer
Dim TableCard(12) As Integer
Dim TableColor(12) As Integer
Dim TableX(12) As Integer
Dim TableY(12) As Integer

Dim HoldCard(4, 4) As Integer
Dim HoldColor(4, 4) As Integer
Dim Sorted(4, 4) As Integer
Dim BoardX(5, 4, 4) As Integer
Dim BoardY(5, 4, 4) As Integer
Dim BoardCard(5, 4, 4) As Integer
Dim BoardColor(5, 4, 4) As Integer

CardColor(1) = 3: CardColor(2) = 4: CardColor(3) = 5: CardColor(4) = 6

fontpath$ = Environ$("SYSTEMROOT") + "\fonts\Arialbd.ttf"
fontpath1$ = Environ$("SYSTEMROOT") + "\fonts\Arial.ttf"

Color 2, 0: font& = _LoadFont(fontpath$, 80): _Font font&
Locate 3, 295: Print "L U C K Y";
Locate 5, 175: Print "N U M B E R S";

Color 15, 0: font& = _LoadFont(fontpath$, 30): _Font font&
Locate 17, 315: Print "How Many Players? ( 1 to 4 )";

GetPlayers:
A$ = InKey$: If A$ = "" GoTo GetPlayers
If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
If Val(A$) < 1 Or Val(A$) > 4 GoTo GetPlayers
Players = Val(A$)

' Setup Deck of Cards
DeckCards = Players * 20
For Z = 1 To DeckCards: Placed(Z) = 0: Next
For Z = 1 To 20
For Y = 1 To Players
Placed: X = Int(Rnd * DeckCards) + 1: If Placed(X) = 0 Then Placed(X) = 1: DeckCard(X) = Z: DeckColor(X) = Y Else GoTo Placed
Next
Next

Cls

' Get Board X, Y Positions
If Players = 4 Then

X = 186: Board = 1
For Z = 1 To 2
W = 186
For Y = 1 To 2
U = X - 122
For T = 1 To 4
V = W - 122
For S = 1 To 4
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
Next
U = U + 81
Next
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
W = W + 363
Next
X = X + 363
Next

ElseIf Players = 3 Then

X = 186: Board = 1
For Z = 1 To 2
If Z = 1 Then R = 2: W = 186 Else R = 1: W = 367
For Y = 1 To R
U = X - 122
For T = 1 To 4
V = W - 122
For S = 1 To 4
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
Next
U = U + 81
Next
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
W = W + 363
Next
X = X + 363
Next

Else

X = 186: W = 186: Board = 1
For Z = 1 To 2
U = X - 122
For T = 1 To 4
V = W - 122
For S = 1 To 4
BoardX(Board, T, S) = V: BoardY(Board, T, S) = U
V = V + 81
Next
U = U + 81
Next
BoardCenterX(Board) = W: BoardCenterY(Board) = X
Board = Board + 1
X = X + 363: W = W + 363
Next

End If

' Draw Board
For Z = 1 To Players
V = BoardCenterX(Z): U = BoardCenterY(Z)
Line (V - 175, U - 175)-(V + 175, U + 175), 1, BF
For Y = 1 To 4
For X = 1 To 4
X1 = BoardX(Z, Y, X): X2 = BoardY(Z, Y, X): X3 = 0: X4 = 0: DrawCard X1, X2, X3, X4
Next
Next
Next

' Setup Table Locations
X = 1: V = 360
For Z = 1 To 4
U = 800
For Y = 1 To 3
TableX(X) = U: TableY(X) = V
X = X + 1: U = U + 81
Next
V = V + 81
Next

Color 2, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (812, 10), "L U C K Y"
_PrintString (774, 35), "N U M B E R S"

Color 15, 0: font& = _LoadFont(fontpath$, 16): _Font font&
Locate 45, 760: Print "Use Michael's Variation? Y or N";

GetVariation:
A$ = UCase$(InKey$): If A$ = "" GoTo GetVariation
If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
If A$ = "Y" Then Variation = 1 Else If A$ = "N" Then Variation = 0 Else GoTo GetVariation

' Add Starting Cursors for Michael's Variation
If Variation = 1 Then

For Z = 1 To Players
For R = 1 To 4
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 45, 750: Print " Place Starting Card on Your Board ";

V = BoardCenterX(Z): U = BoardCenterY(Z)
Line (V - 176, U - 176)-(V + 176, U + 176), 15, B

For Y = 1 To 4
V = BoardX(Z, Y, Y): U = BoardY(Z, Y, Y)
If BoardCard(Z, Y, Y) = 0 Then
Line (V - 39, U - 39)-(V + 39, U + 39), 15, B
Else
Line (V - 39, U - 39)-(V + 39, U + 39), 1, B
End If
Next

X1 = 881: X2 = 110: X3 = Z: X4 = CardColor(Z): DrawCard X1, X2, X3, X4
Color 15, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (833, 155), "Player " + Str$(Z)

Card = DeckCard(DeckCards): CardColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1 = 881: X2 = 350: X3 = Card: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4

PlaceStartingCard:
Do While _MouseInput
For Y = 1 To 4
For X = 1 To 4
If BoardCard(Z, Y, X) = 0 And ((Y = 1 And X = 1) Or (Y = 2 And X = 2) Or (Y = 3 And X = 3) Or (Y = 4 And X = 4)) Then
If _MouseX > BoardX(Z, Y, X) - 40 And _MouseX < BoardX(Z, Y, X) + 40 And _MouseY > BoardY(Z, Y, X) - 40 And _MouseY < BoardY(Z, Y, X) + 40 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (841, 310)-(921, 390), 0, BF
X1 = BoardX(Z, Y, X): X2 = BoardY(Z, Y, X): X3 = Card: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4
Line (BoardX(Z, Y, X) - 39, BoardY(Z, Y, X) - 39)-(BoardX(Z, Y, X) + 39, BoardY(Z, Y, X) + 39), 1, B
Line (BoardCenterX(Z) - 176, BoardCenterY(Z) - 176)-(BoardCenterX(Z) + 176, BoardCenterY(Z) + 176), 0, B
BoardCard(Z, Y, X) = Card: BoardColor(Z, Y, X) = CardColor: GoTo EndPlaceCard
End If
End If
Next
Next
Loop
A$ = InKey$: If A$ <> "" Then If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo PlaceStartingCard

EndPlaceCard:
Next
Next

Else

' Get Hold Cards
For Z = 1 To 4
For Y = 1 To Players
HoldCard(Y, Z) = DeckCard(DeckCards): HoldColor(Y, Z) = DeckColor(DeckCards): DeckCards = DeckCards - 1
Next
Next

' Sort Hold Cards
For Z = 1 To Players
For Y = 1 To 4
LowCard = 100
For X = 1 To 4
If HoldCard(Z, X) < LowCard And Sorted(Z, X) = 0 Then LowCard = HoldCard(Z, X): CardColor = HoldColor(Z, X): T = X
Next
Sorted(Z, T) = 1: X1 = BoardX(Z, Y, Y): X2 = BoardY(Z, Y, Y): X3 = LowCard: X4 = CardColor(CardColor): DrawCard X1, X2, X3, X4
BoardCard(Z, Y, Y) = LowCard: BoardColor(Z, Y, Y) = CardColor
Next
Next

End If

Player = 1: Winner = 0

StartGame:
DrawPile = 0: Table = 0: Occupied = 0

' Draw Player Cursor
Line (BoardCenterX(Player) - 176, BoardCenterY(Player) - 176)-(BoardCenterX(Player) + 176, BoardCenterY(Player) + 176), 15, B
Line (BoardCenterX(Player) - 177, BoardCenterY(Player) - 177)-(BoardCenterX(Player) + 177, BoardCenterY(Player) + 177), 15, B

X1 = 881: X2 = 110: X3 = Player: X4 = CardColor(Player): DrawCard X1, X2, X3, X4
Color 15, 0: font& = _LoadFont(fontpath$, 25): _Font font&
_PrintString (833, 155), "Player " + Str$(Player)

' Display Deck
X1 = 821: X2 = 240: X3 = 100: X4 = 0: DrawCard X1, X2, X3, X4: Line (777, 196)-(865, 284), 15, B
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Draw a Card From the Deck ";

'Draw Cursor Around Table If Not Empty
If TableCards > 0 Then
Color 15, 0: Locate 45, 750: Print " Or Play a Card From the Table ";
Line (756, 316)-(1006, 646), 15, B
Else
Locate 45, 750: Print String$(70, 32);: Line (756, 316)-(1006, 646), 0, B
End If

ChooseAPlay:
Do While _MouseInput

' Draw a Card From the Deck
If _MouseX > 777 And _MouseX < 865 And _MouseY > 196 And _MouseY < 284 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (777, 196)-(865, 284), 0, B: Line (756, 316)-(1006, 646), 15, B
PlayCard = DeckCard(DeckCards): PlayColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1 = 941: X2 = 240: X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4: GoTo PlayDeckCard
End If

' Choose Table Cards
If _MouseX > 756 And _MouseX < 1006 And _MouseY > 316 And _MouseY < 646 And _MouseButton(1) = -1 And TableCards > 0 Then
GoSub ReleaseButton: GoTo ChooseTableCard
End If

Loop
A$ = InKey$: If A$ <> "" Then If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo ChooseAPlay

PlayDeckCard:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Play Card on Your Board ";
Locate 45, 750: Print " Or Move Card to the Table ";

ChoosePlay:
Do While _MouseInput

' Place Card on Table
If _MouseX > 756 And _MouseX < 1006 And _MouseY > 316 And _MouseY < 646 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (897, 196)-(985, 284), 0, BF: Line (756, 316)-(1006, 646), 0, B:
TableCards = TableCards + 1: TableCard(TableCards) = PlayCard: TableColor(TableCards) = PlayColor:
X1 = TableX(TableCards): X2 = TableY(TableCards): X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4: GoTo EndTurn
End If

' Place Card on Board
For Z = 1 To 4
For Y = 1 To 4
If _MouseX > BoardX(Player, Z, Y) - 35 And _MouseX < BoardX(Player, Z, Y) + 35 And _MouseY > BoardY(Player, Z, Y) - 35 And _MouseY < BoardY(Player, Z, Y) + 35 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Row = Z: Column = Y: DrawPile = 1: Table = 0: Routine = 1: GoTo CheckBoardPosition
End If
Next
Next

Loop
A$ = InKey$: If A$ <> "" Then If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo ChoosePlay


ChooseTableCard:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Choose a Table Card to Play ";
Locate 45, 750: Print " Or Draw a Card From the Deck ";

GetTableCard:
Do While _MouseInput

' Choose a Card From the Table
For Z = 1 To TableCards
If _MouseX > TableX(Z) - 35 And _MouseX < TableX(Z) + 35 And _MouseY > TableY(Z) - 35 And _MouseY < TableY(Z) + 35 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (756, 316)-(1006, 646), 0, B: Line (777, 196)-(865, 284), 0, B
Line (TableX(Z) - 41, TableY(Z) - 41)-(TableX(Z) + 41, TableY(Z) + 41), 15, B
PlayCard = TableCard(Z): PlayColor = TableColor(Z): Position = Z: Table = 1: DrawPile = 0: GoTo ChooseBoardPosition
End If
Next

' Choose Draw a Card From the Deck
If _MouseX > 777 And _MouseX < 865 And _MouseY > 196 And _MouseY < 284 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (777, 196)-(865, 284), 0, B: Line (756, 316)-(1006, 646), 15, B
PlayCard = DeckCard(DeckCards): PlayColor = DeckColor(DeckCards): DeckCards = DeckCards - 1
X1 = 941: X2 = 240: X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4: GoTo PlayDeckCard
End If

Loop
A$ = InKey$: If A$ <> "" Then If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo GetTableCard

ChooseBoardPosition:
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Play Card on Your Board ";
If TableCards > 0 Then Locate 45, 750: Print " Or a Choose Table Card ";

GetBoardPosition:
Do While _MouseInput

' Reselect Card on Table
If _MouseX > TableX(Position) - 41 And _MouseX < TableX(Position) + 41 And _MouseY > TableY(Position) - 41 And _MouseY < TableY(Position) + 41 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Line (TableX(Position) - 41, TableY(Position) - 41)-(TableX(Position) + 41, TableY(Position) + 41), 0, B
Line (777, 196)-(865, 284), 15, B: Line (756, 316)-(1006, 646), 15, B: GoTo ChooseTableCard
End If

' Place Card on Board
For Z = 1 To 4
For Y = 1 To 4
If _MouseX > BoardX(Player, Z, Y) - 35 And _MouseX < BoardX(Player, Z, Y) + 35 And _MouseY > BoardY(Player, Z, Y) - 35 And _MouseY < BoardY(Player, Z, Y) + 35 And _MouseButton(1) = -1 Then
GoSub ReleaseButton: Row = Z: Column = Y:: Routine = 2: GoTo CheckBoardPosition
End If
Next
Next

Loop
A$ = InKey$: If A$ <> "" Then If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo GetBoardPosition


CheckBoardPosition:
If BoardCard(Player, Row, Column) > 0 Then Occupied = 1: OldCard = BoardCard(Player, Row, Column): OldColor = BoardColor(Player, Row, Column)

X = 1: X1 = 0: X2 = 0: X3 = 0: X4 = 0

Up: If Row - X >= 1 Then
If BoardCard(Player, Row - X, Column) = 0 Then X = X + 1: GoTo Up Else If PlayCard > BoardCard(Player, Row - X, Column) Then X1 = 1
Else
X1 = 1
End If

X = 1
Dn: If Row + X <= 4 Then
If BoardCard(Player, Row + X, Column) = 0 Then X = X + 1: GoTo Dn Else If PlayCard < BoardCard(Player, Row + X, Column) Then X2 = 1
Else
X2 = 1
End If

X = 1
Lt: If Column - X >= 1 Then
If BoardCard(Player, Row, Column - X) = 0 Then X = X + 1: GoTo Lt Else If PlayCard > BoardCard(Player, Row, Column - X) Then X3 = 1
Else
X3 = 1
End If

X = 1
Rt: If Column + X <= 4 Then
If BoardCard(Player, Row, Column + X) = 0 Then X = X + 1: GoTo Rt Else If PlayCard < BoardCard(Player, Row, Column + X) Then X4 = 1
Else
X4 = 1
End If

CanPlay = 0
If X1 = 1 And X2 = 1 And X3 = 1 And X4 = 1 Then
CanPlay = 1
Else
If Routine = 1 Then GoTo ChoosePlay
If Routine = 2 Then GoTo GetBoardPosition
End If

' Place Card on Board
If CanPlay = 1 Then

' Move Card to the Board
BoardCard(Player, Row, Column) = PlayCard: BoardColor(Player, Row, Column) = PlayColor
X1 = BoardX(Player, Row, Column): X2 = BoardY(Player, Row, Column): X3 = PlayCard: X4 = CardColor(PlayColor): DrawCard X1, X2, X3, X4

' Move Card from Draw Pile
If DrawPile = 1 Then Line (897, 196)-(985, 284), 0, BF

' Move Card from Table
If Table = 1 Then

Line (TableX(Position) - 41, TableY(Position) - 41)-(TableX(Position) + 41, TableY(Position) + 41), 0, BF

While Position < TableCards

TableCard(Position) = TableCard(Position + 1): TableColor(Position) = TableColor(Position + 1)
Line (TableX(Position + 1) - 41, TableY(Position + 1) - 41)-(TableX(Position + 1) + 41, TableY(Position + 1) + 41), 0, BF
X1 = TableX(Position): X2 = TableY(Position): X3 = TableCard(Position): X4 = CardColor(TableColor(Position)): DrawCard X1, X2, X3, X4
Position = Position + 1

Wend

TableCards = TableCards - 1

End If

' Move Old Card to Table
If Occupied = 1 Then
TableCards = TableCards + 1: TableCard(TableCards) = OldCard: TableColor(TableCards) = OldColor
X1 = TableX(TableCards): X2 = TableY(TableCards): X3 = OldCard: X4 = CardColor(OldColor): DrawCard X1, X2, X3, X4
End If

End If

EndTurn:

' Check for Winner
X = 0
For Z = 1 To 4
For Y = 1 To 4
If BoardCard(Player, Z, Y) > 0 Then X = X + 1
Next
Next

If X = 16 Then
Color 15, 0: font& = _LoadFont(fontpath1$, 16): _Font font&
Locate 43, 750: Print " Player"; Player; "is the Winner! ";
Locate 45, 750: Print " Play Another Game? Y or N ";

GetYorN: A$ = UCase$(InKey$): If A$ = "" GoTo GetYorN
If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
If A$ = "Y" Then Run
If A$ = "N" Then System
GoTo GetYorN
End If

Line (BoardCenterX(Player) - 176, BoardCenterY(Player) - 176)-(BoardCenterX(Player) + 176, BoardCenterY(Player) + 176), 0, B
Line (BoardCenterX(Player) - 177, BoardCenterY(Player) - 177)-(BoardCenterX(Player) + 177, BoardCenterY(Player) + 177), 0, B

If Player = Players Then Player = 1 Else Player = Player + 1
GoTo StartGame

ReleaseButton:
Do While _MouseInput
If _MouseButton(1) = 0 Then Return
Loop
GoTo ReleaseButton

Sub DrawCard (X1, X2, X3, X4)

fontpath$ = Environ$("SYSTEMROOT") + "\fonts\Arialbd.ttf"

Line (X1 - 34, X2 - 26)-(X1 - 34, X2 + 26), 2: Line (X1 + 34, X2 - 26)-(X1 + 34, X2 + 26), 2: Line (X1 - 26, X2 - 34)-(X1 + 26, X2 - 34), 2: Line (X1 - 26, X2 + 34)-(X1 + 26, X2 + 34), 2
Circle (X1 - 26, X2 - 26), 8, 2, 1.5, 3.0: Circle (X1 + 26, X2 - 26), 8, 2, 0, 1.6: Circle (X1 - 26, X2 + 26), 8, 2, 3.0, 4.8: Circle (X1 + 26, X2 + 26), 8, 2, 4.5,

If X3 = 100 Then

Paint (X1, X2), 15, 2: Color X4, 15: font& = _LoadFont(fontpath$, 13): _Font font&
Color 2, 15: _PrintString (804, 225), "Lucky": _PrintString (793, 245), "Numbers"

ElseIf X3 > 0 Then

Paint (X1, X2), 2
Line (X1 - 25, X2 - 22)-(X1 - 25, X2 + 22), 15: Line (X1 + 25, X2 - 22)-(X1 + 25, X2 + 22), 15: Line (X1 - 22, X2 - 25)-(X1 + 22, X2 - 25), 15: Line (X1 - 22, X2 + 25)-(X1 + 22, X2 + 25), 15
Circle (X1 - 22, X2 - 22), 3, 15, 1.5, 3.0: Circle (X1 + 22, X2 - 22), 3, 15, 0, 1.6: Circle (X1 - 22, X2 + 22), 3, 15, 3.0, 4.8: Circle (X1 + 22, X2 + 22), 3, 15, 4.5, 0
Paint (X1, X2), 15


Color X4, 15: font& = _LoadFont(fontpath$, 40): _Font font&
If X3 < 10 Then X = 20 Else X = 22
_PrintString (X1 - X, X2 - 15), Right$(Str$(X3), 2)

End If

End Sub



Attached Files
.7z   Lucky Numbers Rules and Rulebook.7z (Size: 2.23 MB / Downloads: 46)
Print this item

  Hex Board Game
Posted by: SMcNeill - 12-23-2023, 12:51 PM - Forum: Donald Foster - No Replies

[Image: index.php?action=dlattach;topic=4488.0;attach=17214]

Hello All,

    Hex is a 2 player abstract strategy board game. The goal is to be the first player to make a continuous connection of pieces that connect the ends of the board. Player 1, the blue pieces, is trying to connect the left side of the board while player 2, the red pieces, is trying to connect the top of the board to the bottom. you can use ESC to alternate between window and full screen.

Hope you enjoy playing

Donald

Code: (Select All)
_Title "Connection Board Game - Programmed by Donald L. Foster Jr. 2020-2021"

Screen _NewImage(1095, 735, 256)

_PaletteColor 1, _RGB32(0, 142, 223) '  Medium Blue
_PaletteColor 2, _RGB32(235, 30, 54) '  Medium Red
_PaletteColor 3, _RGB32(215, 215, 215) ' Grey
_PaletteColor 4, _RGB32(0, 167, 248) '  Light Blue
_PaletteColor 5, _RGB32(0, 117, 198) '  Dark Blue
_PaletteColor 6, _RGB32(255, 55, 74) '  Light Red
_PaletteColor 7, _RGB32(205, 5, 24) '    Dark Red
_PaletteColor 9, _RGB32(1, 1, 1)

Dim As Integer Player, Opponent, Row, Column, Progress, Counter
Dim As Integer Z, Y, X, W, V, X1, X2, X3
Dim As Integer BoardX(13, 13), BoardY(13, 13), BoardPlayer(13, 13), Checked(13, 13)
Dim As Integer PlayerColor(3), StepRow(30), StepColumn(30)

Player = 1: Opponent = 2: Counter = 1: StartingX = 456: StartingY = 67
PlayerColor(1) = 1: PlayerColor(2) = 2

BoardHex$ = "C0TA0BL33D19TA60D38TA120D38TA180D38TA240D38TA300D38TA0D19"

Cls , 15

' Draw Game Board
PSet (43, 74), 0: Draw "TA0D37TA60D36TA0D37TA60D36TA0D37TA60D35TA0D37TA60D36TA0D37TA60D36TA0D37TA60D36TA0D37TA60D36TA0D37TA60D35TA0D37TA60D36TA0D37TA60D36TA0D38"
Draw "TA60D37TA120D37TA60D36TA120D36TA60D36TA120D36TA60D37TA120D37TA60D36TA120D36TA60D36TA120D36TA60D37TA120D37TA60D36TA120D36TA60D37TA120D37TA60D36TA120D36TA60D36TA120D37"
Draw "TA0U37TA240D36TA0U37TA240D35TA0U36TA240D36TA0U37TA240D36TA0U37TA240D36TA0U37TA240D36TA0U37TA240D37TA0U37TA240D36TA0U37TA240D36TA0U37TA240D36TA0U39"
Draw "TA240D36TA300D36TA240D36TA300D36TA240D36TA300D36TA240D36TA300D37TA240D37TA300D36TA240D36TA300D36TA240D37TA300D37TA240D36TA300D36TA240D36TA300D37TA240D37TA300D36TA240D36TA300D37"
Draw "TA240D20TA330D30TA29.5D699TA150ND30TA0R699TA330U30TA240ND28TA330U28TA29.5U699TA150NU30TA0L699TA330D30TA0BD10P1,0BE20P2,0BR695P1,0BD630P2,0"
Paint (200, 100), 9, 0
X = 92: Increase = 0: Indent = 0
For Z = 1 To 11
    Starting = 75
    For Y = 1 To 11
        PSet (Starting + Indent + Increase, X), 15: Draw "C0TA0BL31BU18D36TA60D36TA120D36TA180D36TA240D36TA300D36BR10P3,0"
        '  CIRCLE (Starting + Indent + Increase, X), 28, 0
        BoardX(Z, Y) = Starting + Indent + Increase: BoardY(Z, Y) = X
        If Y = 11 Then Indent = Indent + 31: Increase = 0 Else Increase = Increase + 63
    Next
    X = X + 55
Next

StartGame:
' Draw Player Indicator
Color 0, 15: Locate 3, 97: Print "H  E  X    B  O  A  R  D    G  A  M  E";
PSet (943, 100), 15: Draw BoardHex$: Paint (943, 100), PlayerColor(Player), 0
X1 = 943: X2 = 100: X3 = Player: GoSub DrawPiece
Locate 10, 115: Print "Player"; Player;

Locate 44, 5: Print "Choose Location to Place Your Piece";

GetLocation:
Do While _MouseInput
    For Z = 1 To 11
        For Y = 1 To 11
            If _MouseX > BoardX(Z, Y) - 30 And _MouseX < BoardX(Z, Y) + 30 And _MouseY > BoardY(Z, Y) - 30 And _MouseY < BoardY(Z, Y) + 30 Then Selected = 1 Else Selected = 0
            If _MouseButton(1) = -1 And BoardPlayer(Z, Y) = 0 And Selected = 1 Then
                GoSub ReleaseButton: BoardPlayer(Z, Y) = Player: X1 = BoardX(Z, Y): X2 = BoardY(Z, Y): X3 = Player: GoSub DrawPiece: Row = Z: Column = Y: GoTo CheckForWinner
            End If
        Next
    Next
Loop
A$ = InKey$: If A$ <> "" Then If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo GetLocation

CheckForWinner:
For V = 1 To 11
    For Z = 1 To 11: For Y = 1 To 11: Checked(Z, Y) = 0: Next: Next

    If Player = 1 Then Row = V: Column = 1 Else Row = 1: Column = V

    If BoardPlayer(Row, Column) = Player Then
        Progress = 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1

        CheckWinner: If (Player = 1 And Column = 11) Or (Player = 2 And Row = 11) GoTo Winner

        ' Check Right
        If Column + 1 <= 11 Then
            If BoardPlayer(Row, Column + 1) = Player And Checked(Row, Column + 1) = 0 Then
                Progress = Progress + 1: Column = Column + 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1: GoTo CheckWinner
            End If
        End If

        ' Check Down
        If Row + 1 <= 11 Then
            If BoardPlayer(Row + 1, Column) = Player And Checked(Row + 1, Column) = 0 Then
                Progress = Progress + 1: Row = Row + 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1: GoTo CheckWinner
            End If
        End If

        ' Check Left
        If Column - 1 >= 1 Then
            If BoardPlayer(Row, Column - 1) = Player And Checked(Row, Column - 1) = 0 Then
                Progress = Progress + 1: Column = Column - 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1: GoTo CheckWinner
            End If
        End If

        ' Check Up
        If Row - 1 >= 1 Then
            If BoardPlayer(Row - 1, Column) = Player And Checked(Row - 1, Column) = 0 Then
                Progress = Progress + 1: Row = Row - 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1: GoTo CheckWinner
            End If
        End If

        ' Check Down Left
        If Row + 1 <= 11 And Column - 1 >= 1 Then
            If BoardPlayer(Row + 1, Column - 1) = Player And Checked(Row + 1, Column - 1) = 0 Then
                Progress = Progress + 1: Row = Row + 1: Column = Column - 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1: GoTo CheckWinner
            End If
        End If

        ' Check Up Right
        If Row - 1 >= 1 And Column + 1 <= 11 Then
            If BoardPlayer(Row - 1, Column + 1) = Player And Checked(Row - 1, Column + 1) = 0 Then
                Progress = Progress + 1: Row = Row - 1: Column = Column + 1: StepRow(Progress) = Row: StepColumn(Progress) = Column: Checked(Row, Column) = 1: GoTo CheckWinner
            End If
        End If
    End If

    If Progress > 1 Then Progress = Progress - 1: GoTo CheckWinner

Next

Swap Player, Opponent: GoTo StartGame

ReleaseButton:
Do While _MouseInput
    If _MouseButton(1) = 0 Then Return
Loop

GoTo ReleaseButton


DrawPiece:
If X3 = 1 Then W = 1 Else W = 2
Paint (X1, X2), W, 0
Return

Winner:
PSet (BoardX(StepRow(1), StepColumn(1)), BoardY(StepRow(1), StepColumn(1))), 15
For Z = 2 To Progress: Line -(BoardX(StepRow(Z), StepColumn(Z)), BoardY(StepRow(Z), StepColumn(Z))), 15: Next

If Player = 1 Then
    PSet (BoardX(StepRow(1), StepColumn(1)), BoardY(StepRow(1), StepColumn(1))), 15: Draw "TA300D35"
    PSet (BoardX(StepRow(Progress), StepColumn(Progress)), BoardY(StepRow(Progress), StepColumn(Progress))), 15: Draw "TA120D35"
Else
    PSet (BoardX(StepRow(1), StepColumn(1)), BoardY(StepRow(1), StepColumn(1))), 15: Draw "TA0U35"
    PSet (BoardX(StepRow(Progress), StepColumn(Progress)), BoardY(StepRow(Progress), StepColumn(Progress))), 15: Draw "TA0D35"
End If

Locate 42, 5: Print "    Player"; Player; "is the Winner!";
Locate 44, 5: Print "    Play Another Game?  Y or N      ";

GetYorN:
A$ = UCase$(InKey$): If A$ = "" GoTo GetYorN
If A$ = "Y" Then Run
If A$ = "N" Then System
If Asc(A$) = 27 And FullScreen = 0 Then FullScreen = -1: _FullScreen _SquarePixels , _Smooth Else If Asc(A$) = 27 Then FullScreen = 0: _FullScreen _Off
GoTo GetYorN

Print this item

  Classic board games
Posted by: BG 7 - 12-23-2023, 11:56 AM - Forum: Help Me! - Replies (8)

Does anyone know board games that were programmed in BASIC (especially QB64) and that run under Windows ?

I'm interested in these classic board games: Chess, Backgammon, Checkers, Nine Men's Morris, Go, Shogi, Xiangqi.

Please list everything you can think of - including international ones, collections, works in progress...
Thank you very much !

I'll start with Chess:

Chess RF                      Richard Frost                          QB64
Chess (no AI)               Bob Seguin                              QB64
MiniMAX                      Dieter Steinwender & Chrilly Donninger  QuickBASIC
Chess (GUIchessminimax)                                              FreeBASIC
Just MiniMAX                Ciroth Ungol (&Steinwender & Donninger) Just BASIC
CSS-Schachprogramm    Dieter Steinwender                      BASIC
DemoSchach                H.-J. Kraas & G. Schrüfer & R. Bartel  BASIC 64
JS-Schach                    Roland Chastain                        FreeBASIC
Deep BASIC                 Thomas Mc Burney                        QuickBASIC
Kanguruh                     Thomas Mc Burney                        PowerBASIC
New Proto Chess System 2.01  Sebastian D. Casciaro                  QBASIC 1.1
Schach und andere Strategiespiele  John White                        BASIC
Schach                        G. O. Hamann & J.-J. Eden              BASIC
Chess 1.0 (no AI)         Craig Parmer                            QuickBASIC
...

Backgammon
Blot                        Bernhard Jacob & Hans-Jürgen Schäfer    QB64
JanusBlot                Bernhard Jacob & Hans-Jürgen Schäfer & Lucas Pauws  QB64
...

Checkers
...

Please go on !

Print this item

  quadventure 1.01 = Atari style 2D maze race for 2-4 players
Posted by: madscijr - 12-22-2023, 10:39 PM - Forum: madscijr - No Replies

NOTE: Works in Windows, but the keyboard input routines use _BUTTON which is not currently working on Linux / Mac. 

This is an old school Atari type game kind of like "Maze Craze" or "Adventure", where players race to finish a 2D maze.

From the main menu, select 1 for instructions, and 0 to play. 

I had big plans for this game (see bottom of code for a list) but this is the first fully playable version.



Attached Files
.bas   quadventure-1-01.bas (Size: 437.55 KB / Downloads: 51)
Print this item