|
Post by neuropsychddx on May 16, 2023 11:29:10 GMT -5
I thought making LB edition of games provided in Basic Computer Games would be a great starting point for me as well as for may new comes like me. I am posting the first game in this series "Acey Ducey" LB edition. There are some glitches in the code or rather LB quirks. Please run the code and see how they can be improved upon. Again my request would be to use native LB functions and not use DLLs which many beginners like me may not be able to understand. filebin.net/j8ynt0j36m1oezilPS the link expires is 6 days
|
|
|
Post by xxgeek on May 16, 2023 12:09:59 GMT -5
neuropsychddxThe link may work for you neuropsychddx, but not for others. It took me to a login page to create an account.
|
|
|
Post by neuropsychddx on May 21, 2023 12:29:25 GMT -5
Uploading LB adaptation with controls and sound effects of the Acey Ducey game from "Basic Computer Games" Sorry, associated files are not uploaded. [setup.main.Window]
'-----Begin code for #main
nomainwin WindowWidth = 560 WindowHeight = 510 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "blue"
'-----Begin GUI objects code
statictext #main.title, "Acey Ducey Card Game", 125, 55, 400, 75 TextboxColor$ = "white" 'textbox #main.instructions, 15, 42, 500, 95 statictext #main.money, "You now have 100$", 15, 152, 135, 20 statictext #main.playercards, "Your cards", 15, 182, 104, 20 statictext #main.dealercard, "Dealer card", 420, 182, 104, 20 statictext #main.winlose, "Go!!", 310, 257, 90, 20 button #main.button0,"0",[button0Click], UL, 180, 147, 40, 25 button #main.button5,"5",[button5Click], UL, 230, 147, 40, 25 button #main.button10,"10",[button10Click], UL, 280, 147, 40, 25 button #main.button15,"15",[button15Click], UL, 330, 147, 40, 25 button #main.button20,"20",[button20Click], UL, 380, 147, 40, 25 button #main.button25,"25",[button25Click], UL, 430, 147, 40, 25 button #main.button50,"50",[button50Click], UL, 480, 147, 40, 25 button #main.buttonCont,"Continue", [buttonContClick], UL, 310, 330 'button #main.buttonQuit,"Quit", [quit.main], UL, 310, 370 bmpbutton #main.cardAbmp, "bmp\blank.bmp", [buttonBlankClick], UL, 15, 232 bmpbutton #main.cardBbmp, "bmp\blank.bmp", [buttonBlankClick], UL, 160, 232 bmpbutton #main.dealerCardbmp, "bmp\blank.bmp", [buttonBlankClick], UL, 410, 232 menu #main, "File", "New Game", [newGame], "Quit", [quit.main] menu #main, "Options", "Sound on", [soundOn], "Sound off", [soundOff] menu #main, "Help", "How to play", [instructions], "About", [about] newline$ = chr$(13) + chr$(10)
'-----End GUI objects code
open "Acey Ducey LB edition" for window as #main print #main, "font Arial 10 bold" print #main, "trapclose [quit.main]" print #main.buttonCont, "!disable" print #main.title, "!font Arial 20 bold"
instructions$ = "Acey Ducey is played in the following manner" + newline$ instructions$ = instructions$ + "The dealer deals two cards face up." + newline$ instructions$ = instructions$ + "You have the option to bet or not to bet depending on whether or not you feel" + newline$ instructions$ = instructions$ + "the dealers card will have a value between the first two" + newline$ instructions$ = instructions$ + "If you dont want to bet choose 0" 'print #main.instructions, instructions$ 'print #main.instructions, "!disable" playwave "wav\start.wav", sync ' load card images loadbmp "blank", "bmp\blank.bmp" for i = 2 to 14 cardname$ = "card" + str$(i) filename$ = "bmp\" + str$(i) + ".bmp" loadbmp cardname$, filename$ next i sound = 1 'print #main, "drawbmp card2 10 10"
[newGame] playerMoney = 100 playerCardA = 0 playerCardB = 0 dealerCard = 0 bet = 0 turn = 0
[playShuffleSound] if turn > 0 then print #main.playercards, "Your new cards" turn = turn + 1 print #main.cardAbmp, "bitmap blank" print #main.cardBbmp, "bitmap blank" if sound = 1 then playwave "wav\shuffle.wav", sync
[shuffleCardA] playerCardA = int(rnd(1)*14)+2 if playerCardA < 2 or playerCardA > 14 then goto [shuffleCardA] end if startTime = time$("seconds") ' needed to add the timer as the program was getting stuck in an indefinte loop otherwise
[shuffleCardB] playerCardB =int(rnd(1)*14)+2 currTime = time$("seconds") if currTime - startTime > 5 then goto [shuffleCardA] if playerCardB < 2 or playerCardB > 14 then goto [shuffleCardB] if playerCardB <= playerCardA then goto [shuffleCardB]
[showPlayerCards] cardA$ = "bitmap card" + str$(playerCardA) cardB$ = "bitmap card" + str$(playerCardB) print #main.cardAbmp, cardA$ if sound = 1 then playwave "wav\showcard.wav", sync print #main.cardBbmp, cardB$ if sound = 1 then playwave "wav\showcard.wav", sync
[main.inputLoop] 'wait here for input event wait
[buttonBlankClick] wait
[dealerShuffle] if sound = 1 then playwave "wav\shuffle.wav", sync [shuffleDealer] dealerCard =int(rnd(1)*14)+2 if dealerCard < 2 or dealerCard > 14 then goto [shuffleDealer] cardD$ = "bitmap card" + str$(dealerCard) print #main.dealerCardbmp, cardD$ if sound = 1 then playwave "wav\showcard.wav", sync
if dealerCard > playerCardA AND dealerCard <= playerCardB then print #main.winlose, "You won!!" playerMoney = playerMoney + bet bet = 0 money$ = "You have " + str$(playerMoney) + "$" print #main.money, money$ goto [waitAfterRound] else print #main.winlose, "You lost!!" playerMoney = playerMoney - bet bet = 0 if playerMoney <= 0 then notice "You spend all your Wad!!" playerMoney = 100 print #main.money, "You have 100$" goto [waitAfterRound] else money$ = "You have " + str$(playerMoney)+ "$" print #main.money, money$ goto [waitAfterRound] end if end if
[waitAfterRound] print #main.button0, "!disable" print #main.button5, "!disable" print #main.button10, "!disable" print #main.button15, "!disable" print #main.button20, "!disable" print #main.button25, "!disable" print #main.button50, "!disable" print #main.buttonCont, "!enable" wait
[button0Click] 'Perform action for the button named 'button0' bet = 0 print #main.winlose, "Chicken !!" if sound = 1 then playwave "wav\chicken.wav", sync goto [waitAfterRound]
[button5Click] 'Perform action for the button named 'button5' bet = 5 if playerMoney - bet < 0 then print #main.winlose, "Bet lower!!" goto [dealerShuffle]
[button10Click] 'Perform action for the button named 'button10' bet = 10 if playerMoney - bet < 0 then print #main.winlose, "Bet lower!!" goto [dealerShuffle]
[button15Click] 'Perform action for the button named 'button15' bet = 15 if playerMoney - bet < 0 then print #main.winlose, "Bet lower!!" goto [dealerShuffle]
[button20Click] 'Perform action for the button named 'button20' bet = 20 if playerMoney - bet < 0 then print #main.winlose, "Bet lower!!" goto [dealerShuffle]
[button25Click] 'Perform action for the button named 'button25' bet = 25 if playerMoney - bet < 0 then print #main.winlose, "Bet lower!!" goto [dealerShuffle]
[button50Click] 'Perform action for the button named 'button50' bet = 50 if playerMoney - bet < 0 then print #main.winlose, "Bet lower!!" goto [dealerShuffle]
[buttonContClick] print #main.button0, "!enable" print #main.button5, "!enable" print #main.button10, "!enable" print #main.button15, "!enable" print #main.button20, "!enable" print #main.button25, "!enable" print #main.button50, "!enable" print #main.buttonCont, "!disable" print #main.cardAbmp, "bitmap blank" print #main.cardBbmp, "bitmap blank" print #main.dealerCardbmp, "bitmap blank" print #main.winlose, "New round" goto [playShuffleSound]
[soundOn] sound = 1 goto [main.inputLoop]
[soundOff] sound = 0 goto [main.inputLoop]
[instructions] notice instructions$ goto [main.inputLoop]
[about] notice "Developed by NeuroPsychDDx 2023. Based on the Acey Ducey game from the book Basic Computer Games." goto [main.inputLoop]
[quit.main] 'End the program ' unload images before quitting unloadbmp("blank") for i = 2 to 14 cardname$ = "card" + str$(i) unloadbmp(cardname$) next i close #main end[attachment id="655" thumbnail="1"]
Attachments:
|
|