Created
February 8, 2013 13:21
-
-
Save Daniel15/4739018 to your computer and use it in GitHub Desktop.
This is some (very ugly) code I wrote when I was 11 years old (2001). It was part of this game: http://i.imgur.com/mPE4M46.png. Clearly I was destined to be an artist for video games, but something didn't quite work out :P
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Base 1 | |
Dim cardtxt(23, 3) As String | |
Dim CurPlayer As Integer | |
Dim AmtMoney(4) As Long | |
Dim moved(4) As Integer | |
Dim Level(4) As Integer | |
Dim landowner(7) As Integer | |
Dim colour(4) | |
Dim click1, click2, speed, ended, temp_pic, ok_en, spinner_enabled, won, next_turn | |
Const txt = 1 | |
Const inf = 2 | |
Const amt = 3 | |
Const go = 16 * 88, l2000 = 1 * 88, l1000 = 2 * 88, l10000 = 3 * 88, dung = 4 * 88, pay2000 = 5 * 88 | |
Const l5000 = 6 * 88, pay1000 = 7 * 88, q1 = 8 * 88, get10000 = 9 * 88, la5000 = 10 * 88 | |
Const get2000 = 11 * 88, gotodung = 12 * 88, q2 = 13 * 88, la1000 = 14 * 88, lb5000 = 15 * 88 | |
Sub card_res (what As String, amount As String) | |
Select Case what | |
Case "get": AmtMoney(CurPlayer) = AmtMoney(CurPlayer) + Val(amount): money(CurPlayer - 1) = "$" & AmtMoney(CurPlayer): game.Caption = "Game - Player " & CurPlayer & "'s turn. GET $" & amount & "!" | |
Case "lose": AmtMoney(CurPlayer) = AmtMoney(CurPlayer) - Val(amount): money(CurPlayer - 1) = "$" & AmtMoney(CurPlayer): game.Caption = "Game - Player " & CurPlayer & "'s turn. LOSE $" & amount & "!" | |
Case "freeturn": MsgBox "Free Turn is currently not programmed!" | |
Case "forward" | |
Level(CurPlayer) = Level(CurPlayer) + 1 | |
If Level(CurPlayer) = 6 Then won = CurPlayer: MsgBox "Player " & CurPlayer & " won!", 64, "CONGRADULATIONS!!!": End | |
If Level(CurPlayer) = 6 Then Exit Sub | |
player(CurPlayer - 1).Picture = playlib.GraphicCell(((CurPlayer - 1) + (Level(CurPlayer) * 4))) | |
game.Caption = "Game - Player " & CurPlayer & "'s turn. GO FORWARD 1 LEVEL!" | |
Case "back": Level(CurPlayer) = Level(CurPlayer) - 1 | |
If Level(CurPlayer) = -1 Then Level(CurPlayer) = 0 | |
player(CurPlayer - 1).Picture = playlib.GraphicCell(((CurPlayer - 1) + (Level(CurPlayer) * 4))) | |
game.Caption = "Game - Player " & CurPlayer & "'s turn. GO BACK 1 LEVEL!" | |
Case "start" | |
Call moveme(1496 - moved(CurPlayer)) | |
Case "land" | |
Select Case moved(CurPlayer) | |
Case q1 | |
Call moveme(88 * 2) | |
Call landsub(5, 5000) | |
Case q2 | |
Call moveme(88) | |
Call landsub(6, 1000) | |
End Select | |
Case "jail": MsgBox "Go to dungeon is currently not programmed! It will instead make you 'Just visit\A9' dungeon!": Call card_res("visit", "0") | |
Case "visit" | |
Select Case moved(CurPlayer) | |
Case q1 | |
Call moveme(88 * 13) | |
Case q2 | |
Call moveme(88 * 8) | |
Case gotodung | |
Call moveme(88 * 9) | |
End Select | |
game.Caption = "Player " & CurPlayer & "'s turn - JUST VISITING DUNGEON!" | |
End Select | |
End Sub | |
Sub cards_Click () | |
If ok_en = False Then Exit Sub | |
If cards_ok.Visible = True Then Exit Sub | |
If Right$(app.Path, 2) <> ":\" Then | |
cards.Picture = LoadPicture(app.Path & "\cardsb.bmp") | |
Else | |
cards.Picture = LoadPicture(app.Path & "cardsb.bmp") | |
End If | |
pick = Int(Rnd * 22 + 1) | |
'DEBUG PURPOSES ONLY! - pick = 19 | |
cardinf.Caption = cardtxt(pick, txt) | |
cardinf.Visible = True | |
cardinf.Refresh | |
DoEvents | |
Call card_res(cardtxt(pick, inf), cardtxt(pick, amt)) | |
cards_ok.Visible = True | |
End Sub | |
Sub cards_ok_Click () | |
If Right$(app.Path, 2) <> ":\" Then | |
cards.Picture = LoadPicture(app.Path & "\cards.bmp") | |
Else | |
cards.Picture = LoadPicture(app.Path & "cards.bmp") | |
End If | |
cardinf.Visible = False | |
cards_ok.Visible = False | |
spinner_enabled = True | |
ok_en = False | |
next_turnbtn.Enabled = True | |
End Sub | |
Sub done_spin () | |
Select Case spinner.Value | |
Case Is <= 10: temp2 = 88 * 1: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 1" | |
Case Is <= 20: temp2 = 88 * 2: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 2" | |
Case Is <= 30: temp2 = 88 * 3: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 3" | |
Case Is <= 40: temp2 = 88 * 4: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 4" | |
Case Is <= 50: temp2 = 88 * 5: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 5" | |
Case Is <= 60: temp2 = 88 * 6: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 6" | |
Case Is <= 70: temp2 = 88 * 7: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 7" | |
Case Is <= 80: temp2 = 88 * 8: game.Caption = "Game - Player " & CurPlayer & "'s turn - YOU SPUN A 8" | |
End Select | |
For temp = 1 To temp2 | |
againit: | |
Select Case moved(CurPlayer) | |
Case Is < 4 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left - 1 | |
Case Is < 8 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left, player(CurPlayer - 1).Top - 1 | |
Case Is < 12 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left + 1 | |
Case Is <= 16 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left, player(CurPlayer - 1).Top + 1 | |
Case Is = 1496: moved(CurPlayer) = 0: AmtMoney(CurPlayer) = AmtMoney(CurPlayer) + 1000: money(CurPlayer - 1) = "$" & AmtMoney(CurPlayer): money(CurPlayer - 1).Refresh : Call card_res("forward", "0"): GoTo againit | |
End Select | |
moved(CurPlayer) = moved(CurPlayer) + 1 | |
Next temp | |
Select Case moved(CurPlayer) | |
Case q1: ok_en = True: spinner_enabled = False: game.Caption = "Game - Player " & CurPlayer & "'s turn. GET A QUESTION CARD!" | |
Case q2: ok_en = True: spinner_enabled = False: game.Caption = "Game - Player " & CurPlayer & "'s turn. GET A QUESTION CARD!" | |
Case dung: Call card_res("visit", "0") | |
Case gotodung: Call card_res("jail", "0") | |
Case pay2000: Call card_res("lose", "2000") | |
Case pay1000: Call card_res("lose", "1000") | |
Case get2000: Call card_res("get", "2000") | |
Case get10000: Call card_res("get", "10000") | |
Case l1000: landsub 2, 1000 | |
Case la1000: landsub 6, 1000 | |
Case l2000: landsub 1, 2000 | |
Case l5000: landsub 4, 5000 | |
Case la5000: landsub 5, 5000 | |
Case lb5000: landsub 7, 5000 | |
Case l10000: landsub 3, 10000 | |
End Select | |
next_turn = True | |
next_turnbtn.Visible = True | |
If ok_en = True Then next_turnbtn.Enabled = False | |
End Sub | |
Sub exit_Click () | |
End | |
End Sub | |
Sub Form_Load () | |
'initialise game | |
load_cardtxt | |
speed = 0 | |
Randomize Timer | |
pictlib.Rows = 3 | |
pictlib.Cols = 3 | |
spinner.Picture = pictlib.GraphicCell(0) | |
click1 = False | |
click2 = False | |
player(0).Picture = playlib.GraphicCell(0) | |
player(1).Picture = playlib.GraphicCell(1) | |
player(2).Picture = playlib.GraphicCell(2) | |
player(3).Picture = playlib.GraphicCell(3) | |
moved(1) = 0 | |
moved(2) = 0 | |
moved(3) = 0 | |
moved(4) = 0 | |
spinner_enabled = True | |
AmtMoney(1) = 2000 | |
AmtMoney(2) = 2000 | |
AmtMoney(3) = 2000 | |
AmtMoney(4) = 2000 | |
Level(1) = 0 | |
Level(2) = 0 | |
Level(3) = 0 | |
Level(4) = 0 | |
colour(1) = &HFF& | |
colour(2) = &HFFFF& | |
colour(3) = &HFF00& | |
colour(4) = &HFFFF00 | |
CurPlayer = 1 | |
End Sub | |
Sub landsub (whatland As Integer, cost As Integer) | |
If landowner(whatland) <> 0 Then GoTo Owned | |
buy = MsgBox("This land costs $" & cost & ". The rent if someone else lands on it is $" & cost / 10 & ". Do you want to buy it?", 36, "LAND") | |
If buy = 7 Then Exit Sub | |
If AmtMoney(CurPlayer) < cost Then MsgBox "You don't have enough money!", 64, "LAND": Exit Sub | |
AmtMoney(CurPlayer) = AmtMoney(CurPlayer) - cost | |
money(CurPlayer - 1) = "$" & AmtMoney(CurPlayer) | |
game.Caption = "Game - Player " & CurPlayer & "'s turn. BUY LAND FOR $" & cost | |
land(whatland - 1).FillColor = colour(CurPlayer) | |
landowner(whatland) = CurPlayer | |
Exit Sub | |
Owned: | |
MsgBox "Player " & landowner(whatland) & " owns this land. Rent cost is $" & cost / 10 & ". You MUST pay this payment.", 64, "Land owned by someone else" | |
AmtMoney(CurPlayer) = AmtMoney(CurPlayer) - cost / 10 | |
AmtMoney(landowner(whatland)) = AmtMoney(landowner(whatland)) + cost / 10 | |
money(CurPlayer - 1) = "$" & AmtMoney(CurPlayer) | |
money(landowner(whatland) - 1) = "$" & AmtMoney(landowner(whatland)) | |
game.Caption = "Game - Player " & CurPlayer & "'s turn. PAY FEE OF $" & cost / 10 | |
End Sub | |
Sub load_cardtxt () | |
cardtxt(1, 1) = "Get 3 gold coins." | |
cardtxt(1, 2) = "get" | |
cardtxt(1, 3) = "3000" | |
cardtxt(2, 1) = "Get 4 gold coins." | |
cardtxt(2, 2) = "get" | |
cardtxt(2, 3) = "4000" | |
cardtxt(3, 1) = "Get 1 gold coin." | |
cardtxt(3, 2) = "get" | |
cardtxt(3, 3) = "1000" | |
cardtxt(4, 1) = "Get 2 gold coins." | |
cardtxt(4, 2) = "get" | |
cardtxt(4, 3) = "2000" | |
cardtxt(5, 1) = "Get 3 gold coins." | |
cardtxt(5, 2) = "get" | |
cardtxt(5, 3) = "3000" | |
cardtxt(6, 1) = "Get 5 gold coins." | |
cardtxt(6, 2) = "get" | |
cardtxt(6, 3) = "5000" | |
cardtxt(7, 1) = "NOTHING." | |
cardtxt(7, 2) = "nothing" | |
cardtxt(8, 1) = "BLANK." | |
cardtxt(8, 2) = "nothing" | |
cardtxt(9, 1) = "Lose 2 gold coins" | |
cardtxt(9, 2) = "lose" | |
cardtxt(9, 3) = "2000" | |
cardtxt(10, 1) = "Free Turn!" | |
cardtxt(10, 2) = "freeturn" | |
cardtxt(11, 1) = "Lose 3 gold coins." | |
cardtxt(11, 2) = "lose" | |
cardtxt(11, 3) = "3000" | |
cardtxt(12, 1) = "Lose 1 gold coin." | |
cardtxt(12, 2) = "lose" | |
cardtxt(12, 3) = "1000" | |
cardtxt(13, 1) = "Go forward 1 level." | |
cardtxt(13, 2) = "forward" | |
cardtxt(14, 1) = "Go back 1 level." | |
cardtxt(14, 2) = "back" | |
cardtxt(15, 1) = "Get $500." | |
cardtxt(15, 2) = "get" | |
cardtxt(15, 3) = "500" | |
cardtxt(16, 1) = "Go to nearest land." | |
cardtxt(16, 2) = "land" | |
cardtxt(17, 1) = "Get 50 gold coins" | |
cardtxt(17, 2) = "get" | |
cardtxt(17, 3) = "50000" | |
cardtxt(18, 1) = "Go to dungeon." | |
cardtxt(18, 2) = "jail" | |
cardtxt(19, 1) = "'Just visit' dungeon." | |
cardtxt(19, 2) = "visit" | |
cardtxt(20, 1) = "Go to start." | |
cardtxt(20, 2) = "start" | |
cardtxt(21, 1) = "JACKPOT! GET $1,000,000!" | |
cardtxt(21, 2) = "get" | |
cardtxt(21, 3) = "1000000" | |
cardtxt(22, 1) = "SUPER JACKPOT! GET 10,000 GOLD COINS!" | |
cardtxt(22, 2) = "get" | |
cardtxt(22, 3) = "10000000" | |
cardtxt(23, 1) = "Go straight to king" | |
cardtxt(23, 2) = "king" | |
End Sub | |
Sub moveme (places As Integer) | |
For temp = 1 To places | |
Select Case moved(CurPlayer) | |
Case Is < 4 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left - 1 | |
Case Is < 8 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left, player(CurPlayer - 1).Top - 1 | |
Case Is < 12 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left + 1 | |
Case Is <= 16 * 88: player(CurPlayer - 1).Move player(CurPlayer - 1).Left, player(CurPlayer - 1).Top + 1 | |
Case Is = 1496: moved(CurPlayer) = 0: AmtMoney(CurPlayer) = AmtMoney(CurPlayer) + 1000: money(CurPlayer - 1) = "$" & AmtMoney(CurPlayer): money(CurPlayer - 1).Refresh : Call card_res("forward", "0")': Exit Sub | |
End Select | |
moved(CurPlayer) = moved(CurPlayer) + 1 | |
Next temp | |
End Sub | |
Sub next_turnbtn_Click () | |
skip_click | |
next_turn = False | |
next_turnbtn.Visible = False | |
End Sub | |
Sub skip_click () | |
CurPlayer = CurPlayer + 1: If CurPlayer = 5 Then CurPlayer = 1 | |
For temp = 0 To 3 | |
Line4(temp).Visible = False | |
Line5(temp).Visible = False | |
Line6(temp).Visible = False | |
Next temp | |
Line4(CurPlayer - 1).Visible = True | |
Line5(CurPlayer - 1).Visible = True | |
Line6(CurPlayer - 1).Visible = True | |
game.Caption = "Game - Player " & CurPlayer & "'s turn. - SPIN THE SPINNER!" | |
skip.Enabled = True | |
End Sub | |
Sub spinner_Click () | |
If spinner_enabled = False Then Exit Sub | |
If next_turn = True Then Exit Sub | |
skip.Enabled = False | |
speed = 0 | |
Randomize Timer | |
stopper = Rnd * 1000 + 20000 | |
'Debug.Print stopper | |
If click1 = True Then click2 = True | |
Top: | |
DoEvents | |
click1 = True | |
For temp = 0 To speed: Next temp | |
If ended = True Then GoTo ended | |
spinner.Value = spinner.Value + 1 | |
'Debug.Print spinner.Value \ 10 & " - " & spinner.Value / 10 & " (" & speed & ")" | |
Select Case spinner.Value | |
Case Is <= 10: spinner.Picture = pictlib.GraphicCell(1) | |
Case Is <= 20: spinner.Picture = pictlib.GraphicCell(2) | |
Case Is <= 30: spinner.Picture = pictlib.GraphicCell(3) | |
Case Is <= 40: spinner.Picture = pictlib.GraphicCell(4) | |
Case Is <= 50: spinner.Picture = pictlib.GraphicCell(5) | |
Case Is <= 60: spinner.Picture = pictlib.GraphicCell(6) | |
Case Is <= 70: spinner.Picture = pictlib.GraphicCell(7) | |
Case Is <= 80: spinner.Picture = pictlib.GraphicCell(8) | |
End Select | |
spinner.Refresh | |
DoEvents | |
If spinner.Value = 80 Then spinner.Value = 0 | |
If click2 = True Then | |
If speed >= stopper Then GoTo stoppper | |
speed = speed + 450 | |
End If | |
GoTo Top | |
stoppper: | |
speed = 0 | |
ended = True | |
stopper = 0 | |
done_spin | |
click1 = False | |
click2 = False | |
Exit Sub | |
ended: | |
click1 = False | |
click2 = False | |
ended = False | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Select Case spinner.Value"
Wonder what caused you to forgo division :P