All pastes #231054 Raw Edit

6541561

public text v1 · immutable
#231054 ·published 2006-10-31 16:06 UTC
rendered paste body
View.Set ("graphics:max,max")
var rollcount : array 1 .. 6 of int := init (0, 0, 0, 0, 0, 0)
var die : int
var name : array 1 .. 6 of string
var bets : array 1 .. 6 of int
var spends : array 1 .. 6 of int
var amounts : array 1 .. 6 of int := init (1000, 1000, 1000, 1000, 1000, 1000)
var font : int := Font.New ("Times New Roman:24:bold")
var font2 : int := Font.New ("Times New Roman:36:bold")
var dash: int := Pic.FileNew ("dash.jpg")
var mario : int := Pic.FileNew ("mario.jpg")
var yoshi : int := Pic.FileNew ("yoshi.jpg")
var beast : int := Pic.FileNew ("beast.jpg")
var epona: int := Pic.FileNew ("epona.jpg")
var sonic : int := Pic.FileNew ("sonic.jpg")
var roadrunner : int := Pic.FileNew ("roadrunner.jpg")
var win : int:=0
var winner: string := ""
%MUSIC
process playmusic
    Music.PlayFile ("countdown.mp3")
end playmusic
%RACERS
proc loadracer (var racer : array 1 .. 6 of int)
    for i : 1 .. upper (racer)
        racer (i) := Pic.FileNew ("racer" + intstr (i) + ".jpg")
    end for
end loadracer
var racer : array 1 .. 6 of int

fork playmusic
%INTRO
drawfillbox (0,0,maxx,maxy,grey)
Font.Draw ("Dash",260,350,font2,black)
Font.Draw ("Racer #1",260,300,font2,black)
Pic.Draw (dash, 480,150, picCopy)
delay(2500)
cls
drawfillbox (0,0,maxx,maxy,grey)
Font.Draw ("Mario And",390,350,font2,black)
Font.Draw ("Yoshi",420,300,font2,black)
Font.Draw ("Racer #2",410,250,font2,black)
Pic.Draw (mario, 100,200, picCopy)
Pic.Draw (yoshi, 650,200, picCopy)
delay(2500)
cls
drawfillbox (0,0,maxx,maxy,grey)
Font.Draw ("Beast",500,350,font2,black)
Font.Draw ("Racer #3",500,300,font2,black)
Pic.Draw (beast, 300,150, picCopy)
delay(2500)
cls
drawfillbox (0,0,maxx,maxy,grey)
Font.Draw ("Sonic",250,350,font2,black)
Font.Draw ("Racer #4",250,300,font2,black)
Pic.Draw (sonic, 480,150, picCopy)
delay(2500)
cls
drawfillbox (0,0,maxx,maxy,grey)
Pic.Draw (epona, 0,150, picCopy)
Font.Draw ("Link And",600,350,font2,black)
Font.Draw ("Epona",600,315,font2,black)
Font.Draw ("Racer #5",600,280,font2,black)
delay(2500)
cls
drawfillbox (0,0,maxx,maxy,grey)
Font.Draw ("The Roadrunner",100,350,font2,black)
Font.Draw ("Racer #6",100,300,font2,black)
Pic.Draw (roadrunner, 480,150, picCopy)
delay(2500)
cls


%BETTING
proc names (var name : array 1 .. 6 of string)
    for i : 1 .. upper (name)
        get name (i)
    end for
end names

proc bet (var bets : array 1 .. 6 of int)
    for i : 1 .. upper (bets)
        locate (1 + i, 59)
        get bets (i)
    end for
end bet

proc amount (var amounts : array 1 .. 6 of int)
    for i : 1 .. upper (amounts)
    end for
end amount

proc spend (var spends : array 1 .. 6 of int)
    for i : 1 .. upper (spends)
        locate (1 + i, 37)
        get spends (i)
    end for
end spend



var racers : array 1 .. 6 of int
put "Name", "        ", "Money Won", "       ", "Bet Amount (Up to 1000)", "    ", "Racer(1-6)"
names (name)
amount (amounts)
spend (spends)
bet (bets)
%THE RACE
loadracer (racer)
randomize
drawline (1000, 0, 1000, maxy, black)
drawfillbox (0, 0, maxx, maxy, green)
setscreen ("offscreenonly")
loop
    delay (1)
    randint (die, 1, 6)
    rollcount (die) := rollcount (die) + 1
    drawfillbox (rollcount (die) - 1, die * 105 - 100, rollcount (die) + 10, die * 105, green)
    Font.Draw ("FINISH",900,640,font,black)
    drawline (950,630,950,0,black)
    Pic.Draw (racer (die), rollcount (die), die * 105 - 100, picCopy)
    Font.Draw (intstr (die), 10, die * 110 - 100, font, 7)
    View.Update
    exit when rollcount (die) >= 850
end loop
cls
win := racer(die) - 7009
if win = 1 then
winner := "Dash" 
 
elsif win = 2 then 
winner := "Mario And Yoshi"
 
elsif win = 3 then 
winner := "Beast"
 
elsif win = 4 then 
winner := "Sonic"
 
elsif win = 5 then 
winner := "Link And Epona"
 
elsif win = 6 then 
winner := "The Roadrunner"
end if
Font.Draw (winner,300,350,font2,5)
Font.Draw ("wins!!", 350,300,font2,5) 

View.Update
%END RACE
for i : 1 .. 6
    amounts (i) := amounts (i) - spends (i)
    if bets (i) = die then
        amounts (i) := amounts (i) + spends (i) * 2
    end if
end for
%RACE RESULTS
View.Update
cls
put "Name", "           ", "Money Won", "           ", "Bet Amount", "           ", "Racer"
for i : 1 .. 6
    locate (1 + i, 1)
    put name (i)
    locate (1 + i, 16)
    put amounts (i)
    locate (1 + i, 37)
    put spends (i)
    locate (1 + i, 59)
    put bets (i)
end for