You are not logged in or registered. Please login or register to use the full functionality of this board...
SIGN IN Join Our Community For FREE


Input Board Game in QB64
11-06-2014, 03:30 PM (This post was last modified: 11-06-2014 11:56 PM by Donald Foster.)
Post: #1
 (Print Post)
Input Board Game in QB64
Hello everyone,

I’ve completed writing Input Board Game in QB64. I originally wrote it over 25 years ago on the Tandy 2000 with Keyboard Input. This version I attempted to use Mouse Input. So, this the first Mouse Input game I ever made. I have Included a B&W copy of the Rules of the game I got from the Internet. I’ll make a Color scan and upload it later. I’ll also include a photo of the actual board game.

The Instructions button is not working properly at this time, but I’ve included a scan.

All comments are welcome. Hope you enjoy playing the game!


Code Snippet: [Select]
_TITLE "Input by Donald L. Foster Jr."


SCREEN _NEWIMAGE(1010, 734, 256)

_PALETTECOLOR 1, _RGB32(255, 0, 0) '     Red
_PALETTECOLOR 2, _RGB32(0, 0, 255) '     Blue
_PALETTECOLOR 3, _RGB32(240, 225, 195) ' Moccasin
_PALETTECOLOR 4, _RGB32(130, 130, 130) ' Grey
_PALETTECOLOR 5, _RGB32(254, 254, 254) ' White
_PALETTECOLOR 6, _RGB32(160, 82, 45) '   Sienna
_PALETTECOLOR 7, _RGB32(210, 180, 140)
_PALETTECOLOR 8, _RGB32(244, 164, 96)

CLEAR

DIM PlayingSpace(12), PlayingSpaceX(12), PlayingSpaceY(12), PlayingSpacePlayer(12), PlayingSpacePiece(12), PlayingSpacePosition(12), NextSpace(12), Piece(12), Position(12)
DIM a(12), b(12), LastMove(12), FirsPosition(12)

LINE (0, 0)-(1010, 734), 0, BF

Cursor$ = "R114D114L114U114D1R113D112L112U111R111D110L110U110"
Player = 1: Opponant = 2
PieceCount(1) = 6: PieceCount(2) = 6
StorageBin(1) = 0: StorageBin(2) = 0

DATA 1,7,11,9,6,1,4,10,9,5,2,4,8,12,5,2,7,8,12,6,3,5,7,11,6,3,4,10,8,9
DATA 12,6,2,4,7,12,9,3,4,8,11,9,5,1,8,11,6,5,1,7,10,8,6,2,7,10,9,3,5,4
FOR z = 1 TO 2: FOR y = 1 TO 6: FOR x = 1 TO 5: READ PiecePattern(z, y, x): NEXT: NEXT: NEXT
FOR z = 1 TO 2: FOR y = 1 TO 6: RackSpacePlayed(z, y) = 0: NEXT: NEXT

' Draw Game Board
LINE (0, 0)-(1010, 688), 3, BF
PSET (252, 155), 7: DRAW "R505D377L505U377D1R504D375L503U375"

' Draw INPUT Emblem
FOR z = 1 TO 14
    LINE (838 + z, 691)-(823 + z, 731), 15
    LINE (854 + z, 691)-(839 + z, 731), 15
    LINE (876 + z, 691)-(861 + z, 731), 15
    LINE (892 + z, 691)-(877 + z, 731), 15
    LINE (914 + z, 691)-(899 + z, 731), 15
    LINE (930 + z, 691)-(915 + z, 731), 15
    LINE (952 + z, 691)-(937 + z, 731), 15
    LINE (977 + z, 696)-(962 + z, 731), 15
NEXT
FOR z = 1 TO 33
    LINE (968 + z, 691)-(964 + z, 702), 15
NEXT
LINE (930, 720)-(942, 731), 15, BF
LINE (860, 691)-(877, 702), 15, BF
LINE (898, 691)-(915, 702), 15, BF
CIRCLE (875, 702), 12, 0, 0, 1.5
PAINT (887, 692), 0
CIRCLE (932, 720), 12, 0, 3.0, 4.5
PAINT (921, 729), 0
LINE (895, 708)-(916, 719), 15, BF
CIRCLE (908, 705), 15, 0, 4.5, 1.5
PAINT (924, 692), 0
PAINT (910, 725), 0
PAINT (919, 717), 0
PAINT (919, 716), 0
PSET (904, 719), 15

' Draw Buttons
LOCATE 45, 18: PRINT "Instructions       Start New Game        EXIT  Game";

' Draw Storage Bin
x = 0
FOR z = 1 TO 3
    LINE (272, 32)-(272, 118), 7: LINE (287, 18)-(595, 18), 7: LINE (606, 32)-(606, 119), 7: LINE (285, 134)-(595, 134), 7
    CIRCLE (287, 33), 15, 7, 1.5, 3.0: CIRCLE (287, 119), 15, 7, 3.0, 4.7: CIRCLE (591, 33), 15, 7, 0, 1.5: CIRCLE (591, 119), 15, 7, 4.5, 0
    CIRCLE (591, 33), 8, 7, 0, 1.7: LINE (275, 25)-(591, 25), 7: LINE (599, 33)-(599, 131), 7: PAINT (601, 50), 7

    LINE (736, 567)-(736, 655), 7: LINE (417, 553)-(721, 553), 7: LINE (416, 669)-(721, 669), 7: LINE (402, 567)-(402, 655), 7
    CIRCLE (721, 568), 15, 7, 0, 1.7: CIRCLE (721, 654), 15, 7, 4.7, 0: CIRCLE (417, 568), 15, 7, 1.5, 3.2: CIRCLE (417, 654), 15, 7, 3.0, 4.7
    CIRCLE (721, 568), 8, 7, 0, 1.7: LINE (405, 560)-(721, 560), 7: LINE (729, 568)-(729, 665), 7: PAINT (731, 575), 7

    StorageBinX(1, z) = 678 - x: StorageBinY(1) = 611
    StorageBinX(2, z) = 330 + x: StorageBinY(2) = 76
    x = x + 109
NEXT


' Draw Rack Space
x = 0
FOR z = 1 TO 6
    RackSpaceY(1, z) = 59 + x: RackSpaceY(2, z) = 629 - x
    a = 58: b = RackSpaceY(1, z): C = 1: D = z: GOSUB DrawPiece
    a = 952: b = RackSpaceY(2, z): C = 2: D = z: GOSUB DrawPiece
    x = x + 114
NEXT
RackSpaceX(1) = 59: RackSpaceX(2) = 951

' Draw Playing Space
x = 0: v = 1
FOR z = 1 TO 4
    w = 0
    FOR y = 1 TO 3
        PlayingSpaceX(v) = 311 + x: PlayingSpaceY(v) = 214 + w
        a = 311 + x: b = 214 + w
        GOSUB DrawEmptySpace
        IF z = 1 THEN CIRCLE (311 + x, 214 + w), 13, 1: PAINT (311 + x, 214 + w), 1
        IF z = 4 THEN CIRCLE (311 + x, 214 + w), 13, 2: PAINT (311 + x, 214 + w), 2
        w = w + 129: v = v + 1
    NEXT
    x = x + 129
NEXT

' Draw Entering Space
x = 0: FOR z = 1 TO 3: EnteringSpaceX(1, z) = 311 - x: EnteringSpaceX(2, z) = 698 + x: x = x + 30: NEXT
EnteringSpaceY(1) = 611: EnteringSpaceY(2) = 76
a = 311: b = 611: GOSUB DrawEmptySpace
a = 698: b = 76: GOSUB DrawEmptySpace

x = 0
FOR z = 1 TO 33
    CIRCLE (170, 35 + x), 4, 7, 1.5, 4.5: CIRCLE (230, 35 + x), 4, 7, 4.5, 1.5
    LINE (169, 31 + x)-(231, 31 + x), 7: LINE (169, 39 + x)-(231, 39 + x), 7
    PSET (166, 37 + x), 7: DRAW "E4R63": PAINT (180, 32 + x), 7
    CIRCLE (780, 202 + x), 4, 7, 1.5, 4.5: CIRCLE (840, 202 + x), 4, 7, 4.5, 1.5
    LINE (779, 198 + x)-(841, 198 + x), 7: LINE (779, 206 + x)-(841, 206 + x), 7
    PSET (776, 204 + x), 7: DRAW "E4R63": PAINT (790, 199 + x), 7
    x = x + 14
NEXT
LINE (240, 0)-(248, 530), 7, BF: LINE (119, 524)-(248, 532), 7, BF: LINE (119, 0)-(160, 523), 7, BF
LINE (761, 158)-(769, 688), 7, BF: LINE (761, 155)-(891, 163), 7, BF: LINE (850, 164)-(891, 688), 7, BF

StartGame:
LOCATE 45, 3: PRINT "Player"; Player;
x = 0: v = 14
FOR z = 1 TO 14
    FOR y = 1 TO v
        LINE (837 - y - x, 691)-(822 - y - x, 731), Player
    NEXT
    x = x + 16: v = v - 1
NEXT

' Draw Buttons
x = 0: FOR z = 1 TO 3: LINE (115 + x, 696)-(253 + x, 726), Player, B: x = x + 160: NEXT

EnteringSpaceCounter(1) = 0: EnteringSpaceCounter(2) = 0
PlayerColor(1) = 1: PlayerColor(2) = 2
FOR z = 1 TO 2: FOR y = 1 TO 6: RackSpacePiece(z, y) = z: NEXT: NEXT
FOR z = 1 TO 2: FOR y = 1 TO 3: EnteringSpacePiece(z, y) = 0: NEXT: NEXT
FOR z = 1 TO 12: NextSpace(z) = 0: NEXT

MouseInput:
RackPiece = 0: Space = 0: NextSpace = 0: Piece = 0: Position = 0: Position = 0: EndGame = 0: CanPlay = 0

DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)

    ' Check Rack Space Condition
    FOR z = 1 TO 6
        a1 = RackSpaceX(Player) - 54: a2 = RackSpaceX(Player) + 54: a3 = RackSpaceY(Player, z) - 54: a4 = RackSpaceY(Player, z) + 54
        IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) * (EnteringSpaceCount(Player) < 3) * (RackSpacePlayed(Player, z) = 0) THEN
            RackPiece = z
        END IF
    NEXT

    ' Check Rack Space Mouse Click
    IF (mouseLeftButton = -1) * (RackPiece > 0) * (RackSpacePlayed(Player, RackPiece) = 0) THEN
        LINE (RackSpaceX(Player) - 54, RackSpaceY(Player, RackPiece) - 54)-(RackSpaceX(Player) + 54, RackSpaceY(Player, RackPiece) + 54), 3, BF
        EnteringSpaceCount(Player) = EnteringSpaceCount(Player) + 1
        EnteringSpace(Player, EnteringSpaceCount(Player)) = RackPiece
        RackSpacePlayed(Player, RackPiece) = 1
        a = EnteringSpaceX(Player, EnteringSpaceCount(Player)): b = EnteringSpaceY(Player): C = Player: D = RackPiece: GOSUB DrawPiece
        GOTO EndofTurn
    END IF

    ' Check Entering Space Condition
    a1 = EnteringSpaceX(Player, EnteringSpaceCount(Player)) - 54: a2 = EnteringSpaceX(Player, EnteringSpaceCount(Player)) + 54
    a3 = EnteringSpaceY(Player) - 54: a4 = EnteringSpaceY(Player) + 54
    IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) THEN
        Piece = EnteringSpace(Player, EnteringSpaceCount(Player))
        Position = PiecePattern(Player, Piece, 1)
    END IF

    ' Check Entering Space Mouse Click
    IF (mouseLeftButton = -1) * (PlayingSpacePlayer(Position) <> Player) * (Position > 0) THEN
        IF PlayingSpacePlayer(Position) = Opponant THEN D = PlayingSpacePiece(Position): GOSUB PlacePieceinStorageBin
        PlayingSpacePiece(Position) = Piece
        PlayingSpacePlayer(Position) = Player
        PlayingSpacePosition(Position) = 1
        EnteringSpace(Player, EnteringSpaceCount(Player)) = 0
        EnteringSpaceCount(Player) = EnteringSpaceCount(Player) - 1
        GOSUB RemoveEnteringSpacePieces
        a = PlayingSpaceX(Position): b = PlayingSpaceY(Position): C = Player: D = Piece: GOSUB DrawPiece
        GOTO EndofTurn
    END IF

    ' Get Playing Space Piece Information
    FOR z = 1 TO 12
        IF (mouseX >= PlayingSpaceX(z) - 54) * (mouseX <= PlayingSpaceX(z) + 54) * (mouseY >= PlayingSpaceY(z) - 54) * (mouseY <= PlayingSpaceY(z) + 54) * (PlayingSpacePlayer(z) = Player) THEN
            Space = z
            Piece(z) = PlayingSpacePiece(z)
            Position(z) = PlayingSpacePosition(z)
            IF Position(z) = 5 THEN LastMove(z) = 1 ELSE LastMove(z) = 0
            IF (Position(z) < 5) * (PlayingSpacePlayer(PiecePattern(Player, Piece(z), Position(z) + 1)) <> Player) THEN
                NextSpace(z) = PiecePattern(Player, Piece(z), Position(z) + 1)
                CanPlay=1
            END IF
        END IF
    NEXT

    ' Check Playing Space Mouse Click
    IF (mouseLeftButton = -1) * (PlayingSpacePlayer(Space) = Player)*(CanPlay=1) THEN
        Piece = PlayingSpacePiece(Space)
        Position = PlayingSpacePosition(Space)
        NextSpace = PiecePattern(Player, Piece, Position + 1)
        IF LastMove(Space) = 1 THEN
            Piece = PlayingSpacePiece(Space)
            PSET (RackSpaceX(Player) - 57, RackSpaceY(Player, Piece) - 57), Player: DRAW Cursor$
            IF PlayingSpacePlayer(PiecePattern(Player, Piece, 1)) <> Player THEN
                PSET (PlayingSpaceX(PiecePattern(Player, Piece, 1)) - 57, PlayingSpaceY(PiecePattern(Player, Piece, 1)) - 57), Player: DRAW Cursor$
                FirstPosition = PiecePattern(Player, Piece, 1)
            ELSE FirstPosition = 0
            END IF
            GOTO LastMoveMouseClick
        END IF

        IF PlayingSpacePlayer(NextSpace) <> Player THEN
            IF PlayingSpacePlayer(NextSpace) = Opponant THEN
                D = PlayingSpacePiece(NextSpace)
                GOSUB PlacePieceinStorageBin
            END IF
            PlayingSpacePlayer(NextSpace) = Player
            PlayingSpacePiece(NextSpace) = Piece
            PlayingSpacePosition(NextSpace) = Position + 1
            a = PlayingSpaceX(Space): b = PlayingSpaceY(Space): GOSUB DrawEmptySpace
            PlayingSpacePlayer(Space) = 0
            PlayingSpacePiece(Space) = 0
            PlayingSpacePosition(Space) = 0
            a = PlayingSpaceX(NextSpace): b = PlayingSpaceY(NextSpace): C = Player: D = Piece: GOSUB DrawPiece
            GOTO EndofTurn
        END IF
    END IF

    ' Show Entering Space Pieces
    FOR z = 1 TO EnteringSpaceCount(Player) - 1
        IF Player = 1 THEN a1 = EnteringSpaceX(Player, z) + 24: a2 = EnteringSpaceX(Player, z) + 54: a3 = EnteringSpaceY(Player) - 54: a4 = EnteringSpaceY(Player) + 54
        IF Player = 2 THEN a1 = EnteringSpaceX(Player, z) - 24: a2 = EnteringSpaceX(Player, z) - 54: a3 = EnteringSpaceY(Player) - 54: a4 = EnteringSpaceY(Player) + 54
        IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) THEN Choice = z
    NEXT

    ' Show Entering Space Pieces Mouse Click
    IF (mouseLeftButton = -1) * (Choice > 0) THEN
        IF EnteringSpaceCount(Player) > 1 THEN ShowPiece(Player, 1) = 1 ELSE ShowPiece(Player, 1) = 0
        IF EnteringSpaceCount(Player) > 2 THEN ShowPiece(Player, 2) = 1 ELSE ShowPiece(Player, 2) = 0
        ButtonRelease = 0
        GOSUB ShowEnteringSpacePieces
    END IF

    ' Instruction Button
    IF (mouseLeftButton = -1) * (mouseX > 114) * (mouseX < 254) * (mouseY > 695) * (mouseY < 725) THEN
        GOSUB InstructionButton

    END IF

    ' New Game Button
    IF (mouseLeftButton = -1) * (mouseX > 274) * (mouseX < 414) * (mouseY > 695) * (mouseY < 725) THEN
        EndGame = 1
        GOTO EndGameButton
    END IF

    ' EXIT Game Button
    IF (mouseLeftButton = -1) * (mouseX > 434) * (mouseX < 574) * (mouseY > 695) * (mouseY < 725) THEN
        EndGame = 2
        GOTO EndGameButton
    END IF

LOOP
GOTO MouseInput

EndofTurn:
IF StorageBin(Opponant) = 6 THEN

[size=small][font=Monaco, Consolas, Courier, monospace]    LINE (114, 696)-(573, 726), 0, BF[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    LOCATE 45, 12: PRINT "is the Winner! Play another Game?   Yes       No";[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    LINE (363, 696)-(413, 726), Player, B: LINE (437, 696)-(489, 726), Player, B[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    AnotherGameInput:[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    DO WHILE _MOUSEINPUT[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        mouseX = _MOUSEX[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        mouseY = _MOUSEY[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        mouseLeftButton = _MOUSEBUTTON(1)[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        IF (mouseLeftButton = -1) * (mouseX > 362) * (mouseX < 414) * (mouseY > 695) * (mouseY < 727) THEN RUN[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]        IF (mouseLeftButton = -1) * (mouseX > 436) * (mouseX < 490) * (mouseY > 695) * (mouseY < 727) THEN END[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    LOOP[/font][/size]
[size=small][font=Monaco, Consolas, Courier, monospace]    GOTO AnotherGameInput[/font][/size]
[size=small]END IF[/size]
SWAP Player, Opponant
GOTO StartGame

SLEEP

DrawPiece:
LINE (a - 53, b - 41)-(a - 53, b + 41), 6: LINE (a + 53, b - 41)-(a + 53, b + 41), 6: LINE (a - 41, b - 53)-(a + 41, b - 53), 6: LINE (a - 41, b + 53)-(a + 41, b + 53), 6
CIRCLE (a + 41, b - 41), 12, 6, 0, 1.6: CIRCLE (a - 41, b - 41), 12, 6, 1.5, 3.0: CIRCLE (a - 41, b + 41), 12, 6, 3.0, 4.8: CIRCLE (a + 41, b + 41), 12, 6, 4.6, 0
PAINT (a, b), 6
LINE (a - 53, b - 41)-(a - 53, b + 41), 4: LINE (a + 53, b - 41)-(a + 53, b + 41), 4: LINE (a - 41, b - 53)-(a + 41, b - 53), 4: LINE (a - 41, b + 53)-(a + 41, b + 53), 4
CIRCLE (a + 41, b - 41), 12, 4, 0, 1.6: CIRCLE (a - 41, b - 41), 12, 4, 1.5, 3.0: CIRCLE (a - 41, b + 41), 12, 4, 3.0, 4.8: CIRCLE (a + 41, b + 41), 12, 4, 4.6, 0
PAINT (a, b), 4
LINE (a - 50, b - 37)-(a - 50, b + 37), 0: LINE (a + 50, b - 37)-(a + 50, b + 37), 0: LINE (a - 38, b - 46)-(a + 38, b - 46), 0: LINE (a - 38, b + 46)-(a + 38, b + 46), 0
CIRCLE (a + 40, b - 36), 10, 0, 0, 1.6: CIRCLE (a - 40, b - 36), 10, 0, 1.5, 3.0: CIRCLE (a - 40, b + 36), 10, 0, 3.0, 4.8: CIRCLE (a + 40, b + 36), 10, 0, 4.7, 0
PAINT (a, b), 0
x1 = 0: v1 = 1
FOR z1 = 1 TO 4
    w1 = 0
    FOR y1 = 1 TO 3
        LINE (a - 47 + x1, b - 35 + w1)-(a - 25 + x1, b - 13 + w1), C, BF
        a(v1) = a - 36 + x1: b(v1) = b - 24 + w1
        FOR u1 = 1 TO 5
            IF PiecePattern(C, D, u1) = v1 THEN CIRCLE (a(v1), b(v1)), 7, 15: IF u1 > 1 THEN PAINT (a(v1), b(v1)), 15
        NEXT
        w1 = w1 + 24: v1 = v1 + 1
    NEXT
    x1 = x1 + 24
NEXT
LINE (a(PiecePattern(C, D, 1)), b(PiecePattern(C, D, 1)))-(a(PiecePattern(C, D, 2)), b(PiecePattern(C, D, 2))), 15
LINE (a(PiecePattern(C, D, 2)), b(PiecePattern(C, D, 2)))-(a(PiecePattern(C, D, 3)), b(PiecePattern(C, D, 3))), 15
LINE (a(PiecePattern(C, D, 3)), b(PiecePattern(C, D, 3)))-(a(PiecePattern(C, D, 4)), b(PiecePattern(C, D, 4))), 15
LINE (a(PiecePattern(C, D, 4)), b(PiecePattern(C, D, 4)))-(a(PiecePattern(C, D, 5)), b(PiecePattern(C, D, 5))), 15
CIRCLE (a(PiecePattern(C, D, 1)), b(PiecePattern(C, D, 1))), 7, 5
PAINT (a(PiecePattern(C, D, 1)), b(PiecePattern(C, D, 1))), C, 5
RETURN

DrawEmptySpace:
LINE (a - 54, b - 54)-(a + 54, b + 54), 3, BF
LINE (a - 39, b - 48)-(a + 39, b + 48), 7, B
PSET (a + 32, b + 48), 7: DRAW "U93L67H3L1C15D95R6U89H6"
PAINT (a - 36, b), 15: PAINT (a + 36, b), 7
IF (Space > 0) * (Space < 4) THEN CIRCLE (a, b), 13, 1: PAINT (a, b), 1
IF (Space > 9) * (Space < 13) THEN CIRCLE (a, b), 13, 2: PAINT (a, b), 2
RETURN

RemoveEnteringSpacePieces:
IF Player = 1 THEN LINE (197, 557)-(365, 665), 3, BF
IF Player = 2 THEN LINE (644, 22)-(812, 130), 3, BF
IF (Player = 1) * (EnteringSpaceCount(1) = 0) THEN a = 311: b = 611: GOSUB DrawEmptySpace
IF (Player = 2) * (EnteringSpaceCount(2) = 0) THEN a = 698: b = 76: GOSUB DrawEmptySpace
IF (EnteringSpaceCount(Player) > 0) THEN
    FOR z = 1 TO EnteringSpaceCount(Player)
        a = EnteringSpaceX(Player, z)
        b = EnteringSpaceY(Player)
        C = Player
        D = EnteringSpace(Player, z)
        GOSUB DrawPiece
    NEXT
END IF
RETURN

PlacePieceinStorageBin:
PieceCount(Opponant) = PieceCount(Opponant) - 1
StorageBin(Opponant) = StorageBin(Opponant) + 1
IF StorageBin(Opponant) > 3 THEN BinLocation = StorageBin(Opponant) - 3 ELSE BinLocation = StorageBin(Opponant)
a = StorageBinX(Opponant, BinLocation)
b = StorageBinY(Opponant)
C = Opponant
GOSUB DrawPiece

RETURN

LastMoveMouseClick:
DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)

    a1 = RackSpaceX(Player) - 54: a2 = RackSpaceX(Player) + 54: a3 = RackSpaceY(Player, Piece) - 54: a4 = RackSpaceY(Player, Piece) + 54
    IF (mouseX > a1) * (mouseX < a2) * (mouseY > a3) * (mouseY < a4) THEN RackPiece = Piece ELSE RackPiece = 0

    IF (mouseLeftButton = -1) * (RackPiece > 0) THEN
        FirstPosition = PiecePattern(Player, Piece, 1)
        PSET (RackSpaceX(Player) - 57, RackSpaceY(Player, Piece) - 57), 3: DRAW Cursor$
        PSET (PlayingSpaceX(FirstPosition) - 57, PlayingSpaceY(FirstPosition) - 57), 3: DRAW Cursor$
        PlayingSpacePlayer(Space) = 0
        PlayingSpacePiece(Space) = 0
        PlayingSpacePosition(Space) = 0
        a = PlayingSpaceX(Space): b = PlayingSpaceY(Space)
        GOSUB DrawEmptySpace
        RackSpacePlayed(Player, RackPiece) = 0
        a = RackSpaceX(Player): b = RackSpaceY(Player, Piece): C = Player: D = Piece
        GOSUB DrawPiece
        GOTO EndofTurn
    END IF

    z = FirstPosition
    IF (mouseX >= PlayingSpaceX(z) - 54) * (mouseX <= PlayingSpaceX(z) + 54) * (mouseY >= PlayingSpaceY(z) - 54) * (mouseY <= PlayingSpaceY(z) + 54) THEN Selected = 1 ELSE Selected = 0

    IF (mouseLeftButton = -1) * (Selected = 1) THEN
        IF PlayingSpacePlayer(FirstPosition) = Opponant THEN
            D = PlayingSpacePiece(FirstPosition)
            GOSUB PlacePieceinStorageBin
        END IF
        PSET (RackSpaceX(Player) - 57, RackSpaceY(Player, Piece) - 57), 3: DRAW Cursor$
        PlayingSpacePlayer(Space) = 0
        PlayingSpacePiece(Space) = 0
        PlayingSpacePosition(Space) = 0
        a = PlayingSpaceX(Space): b = PlayingSpaceY(Space)
        FirstPosition = PiecePattern(Player, Piece, 1): GOSUB DrawEmptySpace
        PlayingSpacePlayer(FirstPosition) = Player
        PlayingSpacePiece(FirstPosition) = Piece
        PlayingSpacePosition(FirstPosition) = 1
        a = PlayingSpaceX(FirstPosition): b = PlayingSpaceY(FirstPosition): C = Player: D = Piece: GOSUB DrawPiece
        PSET (PlayingSpaceX(FirstPosition) - 57, PlayingSpaceY(FirstPosition) - 57), 3: DRAW Cursor$
        GOTO EndofTurn
    END IF
LOOP
GOTO LastMoveMouseClick


ShowEnteringSpacePieces:
IF Player = 1 THEN LINE (197, 557)-(365, 665), 3, BF
IF Player = 2 THEN LINE (644, 22)-(812, 130), 3, BF
FOR z = 1 TO Choice
    a = EnteringSpaceX(Player, z)
    b = EnteringSpaceY(Player)
    C = Player
    D = EnteringSpace(Player, z)
    GOSUB DrawPiece
NEXT

MouseButtonRelease:
DO WHILE _MOUSEINPUT
    mouseLeftButton = _MOUSEBUTTON(1)
    IF mouseLeftButton = 0 THEN
        IF Player = 1 THEN LINE (197, 557)-(365, 665), 3, BF
        IF Player = 2 THEN LINE (644, 22)-(812, 130), 3, BF
        FOR z = 1 TO EnteringSpaceCount(Player)
            a = EnteringSpaceX(Player, z)
            b = EnteringSpaceY(Player)
            C = Player
            D = EnteringSpace(Player, z)
            GOSUB DrawPiece
        NEXT
        Choice = 0
        RETURN
    END IF
LOOP
GOTO MouseButtonRelease

InstructionButton:
SHELL "Inside Moves Board Game Rules.pdf"
RETURN

EndGameButton:
LINE (114, 696)-(573, 726), 0, BF
LOCATE 45, 27: PRINT "End This Game?       Yes       No";
LINE (363, 696)-(413, 726), Player, B: LINE (437, 696)-(489, 726), Player, B
GetButtonInput:
DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)
    IF (mouseLeftButton = -1) * (mouseX > 362) * (mouseX < 414) * (mouseY > 695) * (mouseY < 727) THEN
        IF EndGame = 1 THEN RUN ELSE END
    END IF
    IF (mouseLeftButton = -1) * (mouseX > 436) * (mouseX < 490) * (mouseY > 695) * (mouseY < 727) THEN
        LINE (114, 696)-(573, 726), 0, BF
        LOCATE 45, 18: PRINT "Instructions       Start New Game        EXIT  Game";
        x = 0: FOR z = 1 TO 3: LINE (115 + x, 696)-(253 + x, 726), Player, B: x = x + 160: NEXT
        GOTO MouseInput
    END IF
LOOP
GOTO GetButtonInput
Donald
[attachment=298][attachment=299]         [attachment=298]    
.pdf  Input Board Game Rules.PDF (Size: 527.96 KB / Downloads: 114)        


Attached File(s) Image(s)
   

.bas  Input.bas (Size: 19.51 KB / Downloads: 66)
Find all posts by this user
Like Post
The following 1 user Likes Donald Foster's post:
Anthony.R.Brown
11-12-2014, 02:27 PM
Post: #2
 (Print Post)
RE: Input Board Game in QB64
WOW! Another Great game Donald...and again I thought I had seen all the MB Games but you keep pulling New ones I have not seen out of the hat! Wink

Great stuff keep Posting.


Anthony.
Find all posts by this user
Like Post
11-12-2014, 03:12 PM
Post: #3
 (Print Post)
RE: Input Board Game in QB64
Donald,

Anthony was not kidding! I just played your version of the game and it was brilliant!

The graphics are beautifully crafted in code and are very pleasing to the eye. Really nicely done.

One issue I found was when I tried to view the instructions. The *.PDF file name you used in the source code did not match the actual *.PDF that contain the instructions, and when I clicked on the instructions, things went crazy and I couldn't play the game. Once I renamed the file name to the instruction *.PDF file name, it worked just fine.

People will need to download the accompanying *.PDF before they click on the "Instructions" button in the game.

Other than that, the game play was smooth and very entertaining, and I will be playing it again.

Thank you so much for sharing another wonderful game Donald, and great job as always!


Walter Whitman
The Joyful Programmer

Please help support The Joyful Programmer and The QB64 Edition by visiting our online store provided by Amazon.com. We hand-picked books related to computer programming from Amazon.com and added them to our store. When you make a purchase from our store, we do receive a small commission from the sale. Visit our store at: http://www.thejoyfulprogrammer.com/qb64/...azon-store
Find all posts by this user
Like Post
11-12-2014, 09:49 PM
Post: #4
 (Print Post)
RE: Input Board Game in QB64
Thank you both for your responses. I'm so glad you you like it.

 My next goal for this game is to develope an Android App for it and be able to play on tablets with touch screen. Playing sideways, the it's currenly played is actually an un-natural way to play the game. The game board is to be place long ways between the players with their rack of pieces facing them. And the pieces move upwards towards their opponants position.

But there's alot of learning I have to do to make this an Android App.

I'll be making some more of my games with mouse input. This was the best game to try it out with.

Thanks again for the positive inputs.

Donald
Find all posts by this user
Like Post
11-13-2014, 01:27 AM
Post: #5
 (Print Post)
RE: Input Board Game in QB64
Donald,

I wouldn't look at it as an "unnatural way", the "wrong way", or the "right way" to play the game. Just like with programming, or even outer space, I see the way you drew the game on screen as a "different perspective". Sometimes different perspectives allows us to see, and/or understand those things we are familiar with, or think we are familiar with, in a way that could give us new insights, ideas, and/or a better tactical advantage. Looking at things differently could allow us to see things in a whole new light.

On Earth, directions (Up, Down, Left, Right, etc...) are all very common for us, and those concepts are taught to us as soon as we leave our mothers belly, or the test tube chamber (he he). It is an understanding that has become an instinct to us, and our ways of life are primarily based on those concepts. We see through the eyes of those concepts, and our very biological being is designed around them. Our ears helps our bodies to stabilize against the force of gravity and send signals to the brain so it can determine the next split-second course of action it must take. We have come to trust those concepts, and rely on them heavily.

Then, extraterrestrial space ships crashed landed on our planet in the 1950's and we humans took the technologies and built our own space crafts and left the planet. Then all of the sudden, they became confused and disoriented as their most trusted friend vanished. It was at that moment that the Earth's astronauts became enlightened to the truth and reality of a whole new concept, which was there is no such thing as directions, only
perspective.

My whole point here is, just because we look at things in different perspectives, like your game, does not make it bad. It could even make it better once a person accepts the new perspective.

I am going to close this post with a picture (that we all may have already seen) that helps one look at things in different perspectives.


Walter Whitman
The Joyful Programmer

   

Please help support The Joyful Programmer and The QB64 Edition by visiting our online store provided by Amazon.com. We hand-picked books related to computer programming from Amazon.com and added them to our store. When you make a purchase from our store, we do receive a small commission from the sale. Visit our store at: http://www.thejoyfulprogrammer.com/qb64/...azon-store
Find all posts by this user
Like Post
11-14-2014, 05:12 PM
Post: #6
 (Print Post)
RE: Input Board Game in QB64
Walter,

That was a very interesting insight. As off topic as this coversation has become, I agree with you.

Thanks again Donald
Find all posts by this user
Like Post
11-15-2014, 02:47 AM (This post was last modified: 11-15-2014 02:52 AM by Waltersmind.)
Post: #7
 (Print Post)
RE: Input Board Game in QB64
Donald,

I did attempt to sneak in some off-topic material into my message, but it was to help emphasize and have fun with the idea and concept of perspective. Since my overall message was about different perspectives of your game, I feel like it was on-topic. I have to admit though, I love going off on a tangent in my writings, and the longer you hang around me, the more you will see that.

Now to get "off-topic" a bit, and to teach you a little more about me. I never paid much attention in school when it came to learning the intricates of the English language. Even though I loved reading stories in books while growing up (I was and still am a book worm), and coming up with new ones of my own, I never associated Nouns, Pronouns, Adjectives, plurals, idioms, and all the other complex structures of the English language with writing. I thought all I had to do when creating sentences was make them sound right, based on how others at the time wrote. I still follow by that idea for the most part, because I believe that after reading many books and writings over the years, the human mind can see the patterns in the words in a different perspective, and can understand those patterns without having to define them with other words. To me, this is almost like a compression algorithm for the mind which I like to describe as, "Understanding without definition".

I have books on writing and the English language, and though I have learned a lot, I am still trying to wrap my head around the complex definitions of the various parts of writing as well as the "tricks-of-the-trade". I am not perfect, but I enjoy writing and telling stories, which is why many of my posts are long like this one. In saying that, I wish an English teacher / professor would become a member on this forum and tear my writing apart, and help me learn the correct ways of writing.

I guess I should come to a close now on my off-topic message, but before I do, I would like share one last tidbit of information about me. Years ago, when I was doing the FaceBook scene, I posted many short stories on my profile when Facebook allowed such things to happen. But, before FaceBook had the chance to pull the plug, my wife made me remove them completely, saying that I should be sending them in to several writing contests online to see if I could win money. Sadly, I never submitted my stories, nor did I find any other outlet to share them on. Though my favorite topic is science fiction, I can write stories on just about any subject, from the very happy, to the very strange, and can do so without prejudice.

Before she died, my mother and I would play a game of creating stories. Originally one of us would start a story, the other would add to it, and we would go back and forth building ideas on top of ideas. Each of us could send the story in any direction we wanted, but we had to maintain the storyline. Later on though, it became a competition of sorts. We added a new rule to the writing game. When we started and ended our parts of the story, we had to do so with an physical object. To make things even more challenging, the other player had to tell the current story-teller what object to start with, though the current author could end with what ever object they wanted. For example, my mother started one story off with a stone carving of a hand and wrist that appeared to be broken off a complete statue, and the piece was found on an isolated beach, half buried in the sand. I decided to weave a detective story from it, basically like a Nancy Drew novel. The protagonist in my story was female, and the beach was just outside her grandparents estate. That became a very big story that went on for several days. I should put it in a book with the rest of my short stories, but that is fun for another time.

Now I close the off-topic message and get back on topic. I played your game a few more times and still enjoy it.


Walter Whitman
The Joyful Programmer

P.S.,

When I started writing computer programs as a hobby over thirty years ago, I did so in hopes to tell my stories with cool graphics and animations, or even one day be able to immerse players into the midst of my stories. So writing code for me about telling a story.

Please help support The Joyful Programmer and The QB64 Edition by visiting our online store provided by Amazon.com. We hand-picked books related to computer programming from Amazon.com and added them to our store. When you make a purchase from our store, we do receive a small commission from the sale. Visit our store at: http://www.thejoyfulprogrammer.com/qb64/...azon-store
Find all posts by this user
Like Post



Forum Jump:


User(s) browsing this thread: 1 Guest(s)




QB64 Member Project - Connect Four
QB64 Member Project - Color Triangles
QB64 Member Project - Point Blank
QB64 Member Project - Rotating Background
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Foursight
QB64 Member Project - Basic Dithering
QB64 Member Project - Domain
QB64 Member Project - Overboard
QB64 Member Project - Pivet version one
QB64 Member Project - Dreamy Clock
QB64 Member Project - Qubic
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Martin Fractals version three
QB64 Member Project - OpenGL Triangles
QB64 Member Project - Amazon
QB64 Member Project - Martin Fractals version two
QB64 Member Project - Algeria Weather
QB64 Member Project - ARB Checkers
QB64 Member Project - Color Rotating Text
QB64 Member Project - Sabotage
QB64 Member Project - Exit
QB64 Member Project - Swirl
QB64 Member Project - Pivot version two
QB64 Member Project - Score 4
QB64 Member Project - Isolation
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Touche
QB64 Member Project - Martin Fractals version four
QB64 Member Project - Othello
QB64 Member Project - Line Thickness
QB64 Member Project - Martin Fractals version one
QB64 Member Project - Input
QB64 Member Project - Inside Moves
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Bowditch curve
QB64 Member Project - Blokus
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Spiro Roses
QB64 Member Project - Dakapo
QB64 Member Project - Rubix's Magic
QB64 Member Project - Kings Court
QB64 Member Project - RGB Color Wheel
QB64 Member Project - 9 Board
QB64 Member Project - Splatter
QB64 Member Project - Quarto