TGC Codebase Backup



Simple Roulette by Brux

11th Nov 2014 12:08
Summary

Simple roulette just for fun !



Description

simple roulette
just a hobby
try to guess the number that will come out '
Play together with your family and / or friends

simple roulette
just a hobby
try to guess the number that will come out '
Play together with your family and / or friends



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem ***********************************
Rem *         SIMPLE ROULETTE         *
Rem *           (c)2014               *
Rem *       by Ermanno (ITALY)        *
Rem ***********************************
old_tsz=text size()
old_tf$=text font$()

sync on
sync rate 30

azzurro=rgb(0,125,169)
bianco=rgb(250,250,250)
grigio=rgb(160,160,160)
arancio=rgb(255,128,64)

load image "ball3.bmp",1
load sound "endroller.ogg",1
load sound "button.ogg",2
load sound "fireball.ogg",3
set sprite 10,1,1

main:
ink grigio,0
box 0,0,640,480
make_button(azzurro,5,5,630,155,bianco,nero,2)
make_button(azzurro,10,450,630,470,bianco,nero,1)
intesto(10,440,630,450,"SIMPLE ROULETTE    BY ERMANNO (ITALY)",bianco)
make_button(arancio,200,200,400,300,bianco,nero,2)
intesto(200,190,400,280,"CLICK TO START",bianco)

set text font "arialblack"
set text size 48

text 10,30,"0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1"
text 10,70,"1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8"

randomize timer()
n=40
ink bianco,0
for i=1 to 17
 line n,10,n,150
 inc n,35
next i

speed=rnd(5)+25
x=10
sprite 10,x,115,1

rem waiting press mouse button
repeat
if mouseclick()>0
 if mousex()>200 and mousex()<400 and mousey()>200 and mousey()<300
  play sound 2
  anim_button(200,200,400,300) :click=1
 endif
endif
 sync
until click=1
repeat:until sound playing(2)
wait 10
play sound 3
Rem init game
do
if flag=0
 x=x+speed
else
 x=x-speed
endif

if x>600 then flag=1
if x<10 then  flag=0

count=count+1
if count>50
 count=0
 dec speed,rnd(1)+2
endif

if speed<1 then exit

sprite 10,x,115,1
sync
loop

play sound 1
set text font old_tf$
set text size old_tsz
Rem ******************************
Rem            Check             *
Rem ******************************
posx=sprite x (10)
if posx<40 then number=1
if posx>40 and posx<75 then number=2
if posx>75 and posx<110 then number=3
if posx>110 and posx<145 then number=4
if posx>145 and posx<180 then number=5
if posx>180 and posx<215 then number=6
if posx>215 and posx<250 then number=7
if posx>250 and posx<285 then number=8
if posx>285 and posx<320 then number=9
if posx>320 and posx<355 then number=10
if posx>355 and posx<380 then number=11
if posx>380 and posx<415 then number=12
if posx>415 and posx<450 then number=13
if posx>450 and posx<485 then number=14
if posx>485 and posx<520 then number=15
if posx>520 and posx<555 then number=16
if posx>555 and posx<580 then number=17
if posx>580 and posx<615 then number=18

make_button(arancio,200,200,400,300,bianco,nero,2)
intesto(200,190,400,280,"WINS NUMBER "+str$(number),bianco)
intesto(200,250,400,280,"PLAY AGAIN (Y/N)",bianco)
click=0
a$=""
repeat
 a$=inkey$()
sync
until a$>""
if a$="y"
Rem goto main
 goto main
else
 cls
 end
endif


Rem Functions
Function Make_Button(co1,Left,Top,Right,Bottom,co2,co3,shadow)
 Ink 0,0
 If shadow=1 Then Box left,top,right,bottom
 If shadow=2 Then Box left-2,top-2,right+2,bottom+2
 Ink co1,co1
 Box left+1,top+1,right-1,bottom-1
 Ink co2,co2
 Line Left,Bottom,Left,Top : Line Left,Top,Right,Top
 Ink co3,co3
 Line Right,Top,Right,Bottom : Line Right,Bottom,Left,Bottom
EndFunction


Function Intesto(x,y,x1,y1,txt$,ct)
 Ink ct,ct
 c=((x1-x)/2)-((8*Len(txt$))/2)
 Text x+c,y1-((y1-y)/2)+8,txt$
EndFunction

Function Anim_Button(Ax,Ay,Bx,By)
    Copy Bitmap 0,Ax-1,Ay-1,Bx,By,0,Ax,Ay,Bx+1,By+1
    While MouseClick()=1 : Sync :  EndWhile
    Copy Bitmap 0,Ax,Ay,Bx+1,By+1,0,Ax-1,Ay-1,Bx,By
EndFunction