Lotto - first post..not sure where to put this
Community Forums/Showcase/Lotto - first post..not sure where to put this
| ||
;My first post so go easy. Messed about with this for ages. What do ;you think, any tips or help welcome. ;Been messing with this for age. I am a beginner so go easy with ;any comments. lol Dim nums(6) nums(1)=1 nums(2)=11 nums(3)=21 nums(4)=31 nums(5)=41 SeedRnd MilliSecs() oldTime=MilliSecs() r=Rnd(0,255) g=Rnd(0,255) b=Rnd(0,255) zx=50 ; Assign a global variable for the sound Global sndPlayerDie ; Load the sound file into memory sndPlayerDie=LoadSound("start.wav") AppTitle "LOTTERY V1.0 by SKIDMARCUK" ;go into graphics mode Graphics 800,600,16,2 HidePointer SetBuffer BackBuffer() backdrop=CreateImage(800,600) For dot=1 To 500 Color Rnd(0,255),Rnd(0,255),Rnd(0,255) Oval Rnd (1,800),Rnd (1,600), 5,5,1 Next GrabImage backdrop,0,0 ;initialize scroll variable to 0 scroll_y=0 scroll_x=0 ;fonts fntArial=LoadFont("Arial",75,True) fntArial2=LoadFont("Arial",120,True) fntArial3=LoadFont("Arial",50,True) fntArial4=LoadFont("Arial",15,True) ;loop until ESC hit While Not KeyDown(1) Delay 10 ;draw the backdrop TileBlock backdrop,scroll_x,scroll_y ;scroll the backdrop scroll_y=scroll_y+1 scroll_x=scroll_x+1 If scroll_y=ImageHeight(backdrop) Then scroll_y=0 If scroll_x=ImageWidth(backdrop) Then scroll_x=0 ;scrolly effect zx=zx+7 Color 255,255,255 Rect 00,80+Cos(zx)*50,800,2,1 Color 220,220,220 Rect 00,80+Cos(zx-10)*50,800,2,1 Color 195,195,195 Rect 00,80+Cos(zx-20)*50,800,2,1 Color 160,160,160 Rect 00,80+Cos(zx-30)*50,800,2,1 Color 130,130,130 Rect 00,80+Cos(zx-40)*50,800,2,1 Color 100,100,100 Rect 00,80+Cos(zx-50)*50,800,2,1 ;title SetFont fntArial2 Color 0,0,255 For t=0 To 200 Step 20 Viewport 0,0,800,120-t/2 Color 0,0,100+t Text 400+Cos(zz)*100,20,"LOTTERY",True Next zz=zz+5 If zz=360 Then zz=0 Viewport 0,0,800,600 ;button SetFont fntArial3 Color 255,255,255 Rect 100,490,600,75,1 Color 50,50,50 Rect 102,492,596,71,1 ;bakkbox Color 255,255,255 Rect 48,158,714,304,1 For bb=0 To 200 Step 5 ww=ww+10 If ww= 100 Then ww=0 Color 0,0,200-bb/2-ww Rect 50+bb,160+bb,710-bb*2,300-bb*2,1 Next ;mhoops Viewport 102,492,596,71 For ho=1600 To 00 Step -100 Color 00,50,256-ho/8 If MouseDown(1) And MouseX()>100 And MouseX()<700 And MouseY()>490 And MouseY()<560 Then Color 256-ho/8,50,50 EndIf Oval MouseX()-ho/2,MouseY()-ho/2,ho,ho,2 Color 255,255,255 Oval MouseX()-ho/2,MouseY()-ho/2,ho,ho,0 Next Color 200,200,0 Text 400,505,"PRESS TO SPIN BALLS",True Viewport 0,0,800,600 If MouseDown(1) Gosub generate ;pballs For n=1 To 6 If nums(n)<50 Then Color 255,255,0 If nums(n)<40 Then Color 80,80,255 If nums(n)<30 Then Color 255,0,100 If nums(n)<20 Then Color 0,255,0 If nums(n)<10 Then Color 255,255,255 Oval 100*n,255,120,120,1 Color 0,0,0 Oval 100*n,255,120,120,0 Next ;Print numbers Color 0,0,0 SetFont fntArial For n=1 To 6 sh=0 If nums(n)<10 Then sh=20 If nums(n)=0 Then sh=20 Text 100*n+20+sh,255+20,nums(n) If nums(n)=0 Then SetFont fntArial4 Color 255,100,100 Oval 100*n,255,120,120,1 Color 0,0,0 Oval 100*n,255,120,120,0 Color 0,0,0 Text 100*n+17+sh,255+30,"Lottery" Text 100*n+30+sh,255+50,"By" Text 100*n+5+sh,255+70,"SkidMarcUK" EndIf Next ;star For star=0 To 50 Color 255,255,255 Line MouseX(),MouseY(),MouseX()+Rnd(-10,10),MouseY()+Rnd(-10,10) Next ;flip the front and back buffers Flip Wend .generate If MouseX()>100 And MouseX()<700 And MouseY()>490 And MouseY()<560 Then For n=1 To 6 nums(n)=Rnd (1,49) For l=1 To n-1 While nums(n)=nums(l) nums(n)=Rnd (1,49) Wend Next Next PlaySound sndPlayerDie EndIf Return ; :-) |
| ||
not sure where to put this http://www.blitzmax.com/codearcs/codearcs.php |
| ||
Well done On first Attempt :) change this nums(1)=1 nums(2)=11 nums(3)=21 nums(4)=31 nums(5)=41 to that For i=1 To 5 nums(i)=1+j j=j+10 Next Your next step is to learn Functions as it make clear to read and you can break code down :) Last edited 2012 |
| ||
first of all... to keep the structure of your code you can use the "forum codes" here to move code in boxes and keep the format: all possible formating: http://www.blitzbasic.com/faq/faq_entry.php?id=2 If you write BlitzBasic-Code you can use the TAG bbcode and /bbcode in those [] brackets: sample of a code-section: [bbcode] your code [/bbcode] These TAGs format your code from: ;star For star=0 To 50 Color 255,255,255 Line MouseX(),MouseY(),MouseX()+Rnd(-10,10),MouseY()+Rnd(-10,10) Next to.... [bbcode];star For star=0 To 50 Color 255,255,255 Line MouseX(),MouseY(),MouseX()+Rnd(-10,10),MouseY()+Rnd(-10,10) Next [/bbcode] Last edited 2012 |
| ||
Could an admin please make these white boxes with unreadable text in them optional? A check box to keep this nonsense from being displayed would be very helpful, or a check box to automatically convert it to the old method tha was perfectly readable. |
| ||
How is that not readable? Keywords are highlighted in blue, numbers in red, and GOOD GOD IT IS TRUE!!!!!! |
| ||
;initialize scroll variable to 0 Global scroll_y=0 Global scroll_x=0 Global Backdrop Global zz Global fntArial Global fntArial2 Global fntArial3 Global fntArial4 Dim nums(6) For i=1 To 5 nums(i)=1+j j=j+10 Next SeedRnd MilliSecs() oldTime=MilliSecs() r=Rnd(0,255) g=Rnd(0,255) b=Rnd(0,255) zx=50 ; Assign a global variable for the sound Global sndPlayerDie ; Load the sound file into memory sndPlayerDie=LoadSound("start.wav") AppTitle "LOTTERY V1.0 by SKIDMARCUK" ;go into graphics mode Graphics 800,600,16,2 HidePointer SetBuffer BackBuffer() Background() Load_Fonts() ;loop until ESC hit While Not KeyDown(1) Delay 10 Render_All() Flip Wend Function generate() If MouseX()>100 And MouseX()<700 And MouseY()>490 And MouseY()<560 Then For n=1 To 6 nums(n)=Rnd (1,49) For l=1 To n-1 While nums(n)=nums(l) nums(n)=Rnd (1,49) Wend Next Next PlaySound sndPlayerDie EndIf End Function Function Load_Fonts() ;fonts fntArial=LoadFont("Arial",75,True) fntArial2=LoadFont("Arial",120,True) fntArial3=LoadFont("Arial",50,True) fntArial4=LoadFont("Arial",15,True) End Function Function Background() backdrop=CreateImage(800,600) For dot=1 To 500 Color Rnd(0,255),Rnd(0,255),Rnd(0,255) Oval Rnd (1,800),Rnd (1,600), 5,5,1 Next GrabImage backdrop,0,0 End Function Function Render_All() ;scrolly effect zx=zx+7 Color 255,255,255 Rect 00,80+Cos(zx)*50,800,2,1 Color 220,220,220 Rect 00,80+Cos(zx-10)*50,800,2,1 Color 195,195,195 Rect 00,80+Cos(zx-20)*50,800,2,1 Color 160,160,160 Rect 00,80+Cos(zx-30)*50,800,2,1 Color 130,130,130 Rect 00,80+Cos(zx-40)*50,800,2,1 Color 100,100,100 Rect 00,80+Cos(zx-50)*50,800,2,1 ;title SetFont fntArial2 Color 0,0,255 For t=0 To 200 Step 20 Viewport 0,0,800,120-t/2 Color 0,0,100+t Text 400+Cos(zz)*100,20,"LOTTERY",True Next zz=zz+5 If zz=360 Then zz=0 Viewport 0,0,800,600 ;button SetFont fntArial3 Color 255,255,255 Rect 100,490,600,75,1 Color 50,50,50 Rect 102,492,596,71,1 ;draw the backdrop TileBlock backdrop,scroll_x,scroll_y ;scroll the backdrop scroll_y=scroll_y+1 scroll_x=scroll_x+1 If scroll_y=ImageHeight(backdrop) Then scroll_y=0 If scroll_x=ImageWidth(backdrop) Then scroll_x=0 ;bakkbox Color 255,255,255 Rect 48,158,714,304,1 For bb=0 To 200 Step 5 ww=ww+10 If ww= 100 Then ww=0 Color 0,0,200-bb/2-ww Rect 50+bb,160+bb,710-bb*2,300-bb*2,1 Next ;mhoops Viewport 102,492,596,71 For ho=1600 To 00 Step -100 Color 00,50,256-ho/8 If MouseDown(1) And MouseX()>100 And MouseX()<700 And MouseY()>490 And MouseY()<560 Then Color 256-ho/8,50,50 EndIf Oval MouseX()-ho/2,MouseY()-ho/2,ho,ho,2 Color 255,255,255 Oval MouseX()-ho/2,MouseY()-ho/2,ho,ho,0 Next Color 200,200,0 Text 400,505,"PRESS TO SPIN BALLS",True Viewport 0,0,800,600 If MouseDown(1) Then generate() ;pballs For n=1 To 6 If nums(n)<50 Then Color 255,255,0 If nums(n)<40 Then Color 80,80,255 If nums(n)<30 Then Color 255,0,100 If nums(n)<20 Then Color 0,255,0 If nums(n)<10 Then Color 255,255,255 Oval 100*n,255,120,120,1 Color 0,0,0 Oval 100*n,255,120,120,0 Next ;Print numbers Color 0,0,0 SetFont fntArial For n=1 To 6 sh=0 If nums(n)<10 Then sh=20 If nums(n)=0 Then sh=20 Text 100*n+20+sh,255+20,nums(n) If nums(n)=0 Then SetFont fntArial4 Color 255,100,100 Oval 100*n,255,120,120,1 Color 0,0,0 Oval 100*n,255,120,120,0 Color 0,0,0 Text 100*n+17+sh,255+30,"Lottery" Text 100*n+30+sh,255+50,"By" Text 100*n+5+sh,255+70,"SkidMarcUK" EndIf Next ;star For star=0 To 50 Color 255,255,255 Line MouseX(),MouseY(),MouseX()+Rnd(-10,10),MouseY()+Rnd(-10,10) Next End Function Hints 1 - find one Gobal Variable for blue middle background moving :) Hints 2 - Learn how to get Lotto text Show on the screen(That would give you good Brain workout :P) Good Luck :) I could have split all in functions for it to make easier but just dont have the time to do them all and I am sure you will see functions is good and make your code look better :) Last edited 2012 |
| ||
How is that not readable? Given the thickness of your glasses in your video, you should be able to answer your own question in another 5-10 years :) |
| ||
The code box style Hotshot posted is much easier on the eye than the whitebox and the text using those colours. |
| ||
The code box style Hotshot posted is much easier on the eye than the whitebox and the text using those colours. Indeed, and I have stated this before. Unfortunately, there is somebody hacking the forums and sabotaging them in the name of progress. There are reasons that BM/B3D/B+ do not use the horrid white background for the IDEs of the products. The white code boxes need to be optional and we need to be able to turn those off. It completely destroys any thread they are in, as you have unreadable code in a white box in the middle of the thread. |
| ||
Thanks for all your feedback. I am currently adding lots of functions to code and having a go at embedding code now. Thanks again. [bbcode] 10 SHOOT THINGS 20 DIE 30 GOTO 10 [/bbcode] HERE GOES NOTHING!!!!! |
| ||
@GaryV what are you talking about? For me all text looks perfect. Perhaps the skin you use is nt very helpful? I'm using the default skin and there is never any white box and never any unreadable text! The "bbcode" Tag creates a coloured text on a grey background. |
| ||
For i=1 To 5 nums(i)=i*10-9 Next LOL |