buttons2 not sure how but it works
BlitzPlus Forums/BlitzPlus Beginners Area/buttons2 not sure how but it works
| ||
Had a go at the buttons again all got a bit messy and big but at least it works. just..lol. ;GUIde 1.4 BlitzPlus export AppTitle "Horoscope by SkidMarcUK" Global dat Global mon Global EditWindow Global canv Global btnButton0 Global btnButton1 Global btnButton2 Global click Global chimes Global hei Global fntArial1 Global fntArial2 Global fntArial3 Global fntArial4 Global ttt ;load stuff ;fonts fntArial1=LoadFont("Arial",75,True) fntArial2=LoadFont("Arial",120,True) fntArial3=LoadFont("Arial",40,True) fntArial4=LoadFont("Arial",23,True) click=LoadSound("start.wav") chimes=LoadSound("chimes.wav") mon=1 dat=1 ;create screen EditWindow=CreateWindow("Horoscope by SkidMarcUK",GadgetWidth(Desktop())/2 -320,GadgetHeight(Desktop())/2 -320,640,520,0,1) btnButton0=CreateButton("January",24,424,232,48,EditWindow,1) SetGadgetLayout btnButton0,1,0,1,0 btnButton1=CreateButton("1",272,424,232,48,EditWindow,1) SetGadgetLayout btnButton1,1,0,1,0 btnButton2=CreateButton("GO",520,424,88,48,EditWindow,1) SetGadgetLayout btnButton2,1,0,1,0 canv=CreateCanvas ( 0,0,640,520,EditWindow) ; Create array Dim month$(12) month(1) = "January" month(2) = "February" month(3) = "March" month(4) = "April" month(5) = "May" month(6) = "June" month(7) = "July" month(8) = "August" month(9) = "September" month(10) = "October" month(11) = "November" month(12) = "December" Dim nums1(64) Dim nums2(64) ;set stuff SetBuffer(CanvasBuffer(canv)) SetGadgetFont btnButton0,fntArial3 SetGadgetFont btnButton1,fntArial3 SetGadgetFont btnButton2,fntArial3 ;stars Cls Starfield1=CreateImage(640,480) Color 75,75,75 For dot=1 To 150 Oval Rnd (1,640),Rnd (1,480), 3,3,1 Next GrabImage Starfield1,0,0 Starfield2=CreateImage(640,480) Cls Color 125,125,125 For dot2=1 To 100 Oval Rnd (1,640),Rnd (1,480), 4,4,1 Next GrabImage Starfield2,0,0 Starfield3=CreateImage(640,480) Cls Color 200,200,200 For dot3=1 To 50 Oval Rnd (1,640),Rnd (1,480), 5,5,1 Next GrabImage Starfield3,0,0 ; Fill each element with a random number For i = 0 To 63 nums1(i) = Rand(70,100) Next ; Fill each element with a random number For j = 0 To 63 nums2(i) = Rand(70,100) Next For l=0 To 63 Step 1 Color nums1(l),0,nums1(l) Rect l*10,0,10,640,1 Next ;-mainloop-------------------------------------------------------------- Repeat Cls hei=115 ;Cls DoGadgetAction( gadget ) id=WaitEvent(0) Select id Case $401 ; interacted with gadget DoGadgetAction( EventSource() ) Case $803 ; close gadget Exit End Select t=t+1 If t=10 Then ; Fill each element with a random number For i = 0 To 63 nums1(i) = Rand(70,100) Next ; Fill each element with a random number For j = 0 To 63 nums2(i) = Rand(70,100) Next t=0 EndIf For l=0 To 63 Step 1 Color nums1(l),0,nums1(l) Rect l*10,0,10,640,1 Next Color 255,255,255 Rect 55,95,530,310 Viewport 60,100,520,300 ;draw the backdrop TileBlock Starfield1,scroll_x,0 ;draw it again, but across a bit and moving 'faster' TileImage Starfield2,scroll_x*2,9 ;and again! TileImage Starfield3,scroll_x*3,23 ;scroll the backdrop scroll_x=scroll_x+1 If scroll_x=ImageWidth(Starfield3) Then scroll_x=0 Viewport 0,0,800,600 SetFont fntArial1 Color 0,0,0 Text 330+Cos(zz)*50,20,"HOROSCOPE",True Color 0,0,255 Text 320+Cos(zz)*50,5,"HOROSCOPE",True zz=zz+5 If zz=360 Then zz=0 SetFont fntArial4 If ttt=0 : setup() :EndIf If ttt=1 : Capricorn() :EndIf If ttt=2 : Aquarius() :EndIf If ttt=3 : Pisces() :EndIf If ttt=4 : Aries() :EndIf If ttt=5 : Taurus() :EndIf If ttt=6 : Gemini() :EndIf If ttt=7 : Cancer() :EndIf If ttt=8 : Leo() :EndIf If ttt=9 : Virgo() :EndIf If ttt=10 : Libra() :EndIf If ttt=11 : Scorpio() :EndIf If ttt=12 : Sagittarius() :EndIf Delay 40 FlipCanvas(canv) Forever ;-gadget actions-------------------------------------------------------- Function DoGadgetAction( gadget ) Select gadget Case btnButton0 : b1() Case btnButton1 : b2() Case btnButton2 : b3() End Select End Function ;-button actions-------------------------------------------------------- Function b1() PlaySound click mon=mon+1 SetGadgetText btnButton0,month$(mon) If mon=12 Then mon=0 End Function Function b2() PlaySound click dat=dat+1 SetGadgetText btnButton1,dat If dat=31 Then dat=0 End Function Function b3() PlaySound chimes txtscreen() End Function Function txtscreen() ;jan If mon=1 And dat<21 Then ttt=1 EndIf If mon=1 And dat>20 Then ttt=2 EndIf ;feb If mon=2 And dat<20 Then ttt=2 EndIf If mon=2 And dat>19 Then ttt=3 EndIf ;march If mon=3 And dat<21 Then ttt=3 EndIf If mon=3 And dat>20 Then ttt=4 EndIf ;april If mon=4 And dat<21 Then ttt=4 EndIf If mon=4 And dat>20 Then ttt=5 EndIf ;may If mon=5 And dat<22 Then ttt=5 EndIf If mon=5 And dat>21 Then ttt=6 EndIf ;june If mon=6 And dat<22 Then ttt=6 EndIf If mon=6 And dat>21 Then ttt=7 EndIf ;july If mon=7 And dat<23 Then ttt=7 EndIf If mon=7 And dat>22 Then ttt=8 EndIf ;august If mon=8 And dat<23 Then ttt=8 EndIf If mon=8 And dat>22 Then ttt=9 EndIf ;september If mon=9 And dat<24 Then ttt=9 EndIf If mon=9 And dat>23 Then ttt=10 EndIf ;october If mon=10 And dat<24 Then ttt=10 EndIf If mon=10 And dat>23 Then ttt=11 EndIf ;november If mon=11 And n<23 Then ttt=11 EndIf If mon=11 And n>22 Then ttt=12 EndIf ;december If mon=12 And dat<22 Then ttt=12 EndIf If mon=12 And dat>21 Then ttt=1 EndIf End Function Function Capricorn() Text 320,hei,"Capricorn - The Goat",1 hei=hei+20 Text 320,hei,"December 22 to January 20",1 hei=hei+40 Text 320,hei,"Traditional Capricorn Traits....",1 hei=hei+20 Text 320,hei,"Practical And prudent" ,1 hei=hei+20 Text 320,hei,"Ambitious And disciplined" ,1 hei=hei+20 Text 320,hei,"Patient And careful",1 hei=hei+20 Text 320,hei,"Humorous And reserved" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Pessimistic And fatalistic" ,1 hei=hei+20 Text 320,hei,"Miserly And grudging" ,1 hei=hei+20 Text 320,hei,"Over conventional And rigid",1 End Function Function Aquarius() Text 320,hei,"Aquarius - The Water Carrier",1 hei=hei+20 Text 320,hei,"January 21 To February 19",1 hei=hei+40 Text 320,hei,"Traditional Aquarian Traits....",1 hei=hei+20 Text 320,hei,"Friendly and humanitarian" ,1 hei=hei+20 Text 320,hei,"Honest and loyal" ,1 hei=hei+20 Text 320,hei,"Original and inventive",1 hei=hei+20 Text 320,hei,"Independent and intellectual" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Intractable and contrary" ,1 hei=hei+20 Text 320,hei,"Perverse and unpredictable" ,1 hei=hei+20 Text 320,hei,"Unemotional and detached",1 End Function Function Pisces() Text 320,hei,"Pisces - The Fishes",1 hei=hei+20 Text 320,hei,"Febuary 20 to March 20",1 hei=hei+40 Text 320,hei,"Traditional Pisces Traits....",1 hei=hei+20 Text 320,hei,"Imaginative and sensitive" ,1 hei=hei+20 Text 320,hei,"Compassionate and kind" ,1 hei=hei+20 Text 320,hei,"Selfless and unworldly",1 hei=hei+20 Text 320,hei,"Intuitive and sympathetic" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Escapist and idealistic" ,1 hei=hei+20 Text 320,hei,"Secretive and vague" ,1 hei=hei+20 Text 320,hei,"Weak-willed and easily led",1 End Function Function Aries() Text 320,hei,"Aries - The Ram",1 hei=hei+20 Text 320,hei,"March 21 to April 20",1 hei=hei+40 Text 320,hei,"Traditional Aries Traits....",1 hei=hei+20 Text 320,hei,"Adventurous and energetic" ,1 hei=hei+20 Text 320,hei,"Pioneering and courageous" ,1 hei=hei+20 Text 320,hei,"Enthusiastic and confident",1 hei=hei+20 Text 320,hei,"Dynamic and quick-witted" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Selfish and quick-tempered" ,1 hei=hei+20 Text 320,hei,"Impulsive and impatient" ,1 hei=hei+20 Text 320,hei,"Foolhardy and daredevil",1 End Function Function Taurus() Text 320,hei,"Taurus - The Bull",1 hei=hei+20 Text 320,hei,"April 21 to May 21",1 hei=hei+40 Text 320,hei,"Traditional Taurus Traits....",1 hei=hei+20 Text 320,hei,"Patient and reliable" ,1 hei=hei+20 Text 320,hei,"Warmhearted and loving",1 hei=hei+20 Text 320,hei,"Persistent and determined",1 hei=hei+20 Text 320,hei,"Placid and security loving" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Jealous and possessive" ,1 hei=hei+20 Text 320,hei,"Resentful and inflexible" ,1 hei=hei+20 Text 320,hei,"Self-indulgent and greedy",1 End Function Function Gemini() Text 320,hei,"Gemini - The Twins",1 hei=hei+20 Text 320,hei,"Gemini May 22 to June 21",1 hei=hei+40 Text 320,hei,"Traditional Gemini traits....",1 hei=hei+20 Text 320,hei,"Adaptable and versatile" ,1 hei=hei+20 Text 320,hei,"Communicative and witty",1 hei=hei+20 Text 320,hei,"Intellectual and eloquent",1 hei=hei+20 Text 320,hei,"Youthful and lively" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Nervous and tense" ,1 hei=hei+20 Text 320,hei,"Superficial and inconsistent" ,1 hei=hei+20 Text 320,hei,"Cunning and inquisitive",1 End Function Function Cancer() Text 320,hei,"Cancer - The Crab",1 hei=hei+20 Text 320,hei,"June 22 to July 22",1 hei=hei+40 Text 320,hei,"Traditional Cancer Traits....",1 hei=hei+20 Text 320,hei,"Emotional and loving" ,1 hei=hei+20 Text 320,hei,"Intuitive and imaginative",1 hei=hei+20 Text 320,hei,"Shrewd and cautious",1 hei=hei+20 Text 320,hei,"Protective and sympathetic" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Changeable and moody" ,1 hei=hei+20 Text 320,hei,"Overemotional and touchy" ,1 hei=hei+20 Text 320,hei,"Clinging and unable to let go",1 End Function Function Leo() Text 320,hei,"Leo - The Lion",1 hei=hei+20 Text 320,hei,"July 23 to August 22",1 hei=hei+40 Text 320,hei,"Traditional Leo Traits....",1 hei=hei+20 Text 320,hei,"Generous and warmhearted" ,1 hei=hei+20 Text 320,hei,"Creative and enthusiastic",1 hei=hei+20 Text 320,hei,"Broad-minded and expansive",1 hei=hei+20 Text 320,hei,"Faithful and loving" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Pompous and patronizing",1 hei=hei+20 Text 320,hei,"Bossy and interfering" ,1 hei=hei+20 Text 320,hei,"Dogmatic and intolerant",1 End Function Function Virgo() Text 320,hei,"Virgo - The Virgin",1 hei=hei+20 Text 320,hei,"August 23 to September 23",1 hei=hei+40 Text 320,hei,"Traditional Virgo Traits....",1 hei=hei+20 Text 320,hei,"Modest and shy" ,1 hei=hei+20 Text 320,hei,"Meticulous and reliable",1 hei=hei+20 Text 320,hei,"Practical and diligent",1 hei=hei+20 Text 320,hei,"Intelligent and analytical" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Fussy and a worrier" ,1 hei=hei+20 Text 320,hei,"Overcritical and harsh" ,1 hei=hei+20 Text 320,hei,"Perfectionist and conservative",1 End Function Function Libra() Text 320,hei,"Libra - The Scales",1 hei=hei+20 Text 320,hei,"September 24 to October 23",1 hei=hei+40 Text 320,hei,"Traditional Libra Traits....",1 hei=hei+20 Text 320,hei,"Diplomaitic and urbane" ,1 hei=hei+20 Text 320,hei,"Romantic and charming",1 hei=hei+20 Text 320,hei,"Easygoing and sociable",1 hei=hei+20 Text 320,hei,"Idealistic and peaceable" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Indecisive and changeable" ,1 hei=hei+20 Text 320,hei,"Gullible and easily infuenced" ,1 hei=hei+20 Text 320,hei,"Flirtatious and self-indulgent",1 End Function Function Scorpio() Text 320,hei,"Scorpio - The Scorpion",1 hei=hei+20 Text 320,hei,"October 24 to November 22",1 hei=hei+40 Text 320,hei,"Determined and forceful....",1 hei=hei+20 Text 320,hei,"Traditional Scorpio Traits" ,1 hei=hei+20 Text 320,hei,"Determined and forceful" ,1 hei=hei+20 Text 320,hei,"Powerful and passionate",1 hei=hei+20 Text 320,hei,"Exciting and magnetic" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Jealous and resentful" ,1 hei=hei+20 Text 320,hei,"Compulsive and obsessive" ,1 hei=hei+20 Text 320,hei,"Secretive and obstinate",1 End Function Function Sagittarius() Text 320,hei,"Sagittarius - The Archer",1 hei=hei+20 Text 320,hei,"November 23 to December 21",1 hei=hei+40 Text 320,hei,"Traditional Sagittarius Traits....",1 hei=hei+20 Text 320,hei,"Optimistic and freedom-loving" ,1 hei=hei+20 Text 320,hei,"Jovial and good-humored" ,1 hei=hei+20 Text 320,hei,"Honest and straightforward",1 hei=hei+20 Text 320,hei,"Intellectual and philosophical" ,1 hei=hei+40 Text 320,hei,"On the dark side...." ,1 hei=hei+20 Text 320,hei,"Blindly optimistic and careless" ,1 hei=hei+20 Text 320,hei,"Irresponsible and superficial" ,1 hei=hei+20 Text 320,hei,"Tactless and restless",1 End Function Function setup() Text 320,hei,"Horoscope",1 hei=hei+40 Text 320,hei,"A forecast of a person's future",1 hei=hei+20 Text 320,hei,"typically including a delineation",1 hei=hei+20 Text 320,hei,"of character And circumstances" ,1 hei=hei+20 Text 320,hei,"based on the relative positions of" ,1 hei=hei+20 Text 320,hei,"the stars and planets at the ",1 hei=hei+20 Text 320,hei,"time of that person's birth." ,1 hei=hei+40 Text 320,hei,"It literally means a map of the" ,1 hei=hei+20 Text 320,hei,"stars at the time of ones birth." ,1 hei=hei+20 Text 320,hei, "" ,1 hei=hei+20 Text 320,hei,"From Greek horoskopos observing the hours.",1 End Function When i embedded it it didnt work any more ...added some ;;;'s dont know why Last edited 2012 |
| ||
not sure how to delete post and start again Last edited 2012 |
| ||
not sure how to delete post and start again Use the 'Edit' link on the top-right of your post to edit it. You can also use several different codebox tags to encapsulate the code above. Forum codes link is below. http://www.blitzbasic.com/faq/faq_entry.php?id=2 |