Computer Science Canada Can someone please assist me with this =/ |
Author: | Jundu [ Sun Jan 04, 2009 8:04 pm ] |
Post subject: | Can someone please assist me with this =/ |
Okay so i have to make a game where the user has to sort blocks from biggest to smallest. Now i kind of bad at Turing but I need some pointers. Please i wish to learn so would you just give me some tips/hints and refrain from giving me the answers Can someone please tell why my button won't work and can they give me some clues on how to go about doing the project as a whole (as how to make the blocks respond to the mouse, general hints) Here's my source code, my first problem is making the Main Menu button work import GUI var mainWinID := Window.Open ("graphics:500;500") var font1 : int font1 := Font.New("Arial:12:bold") setscreen ("offscreenonly") procedure title cls Font.Draw ("Sort the Blocks!",200,470, font1, red) GUI.Refresh end title procedure mainMenu if GUI.ProcessEvent then var win2ID := Window.Open ("graphics:500;500") title locate (5,1) put "ffgffge" %note this is test text when the program actually successfully takes me to the main menu I'll change it end if end mainMenu procedure introduction import mainMenu,GUI locate (4,2) put "See if you can sort the blocks from smallest to largest!" var menuButton :int := GUI.CreateButton (10,10,10,"Main Menu",mainMenu) end introduction title introduction mainMenu Help me please D: |
Author: | Insectoid [ Sun Jan 04, 2009 8:29 pm ] |
Post subject: | RE:Can someone please assist me with this =/ |
First, GUI = bad. Make your own buttons with Mouse.Where and Draw.Box. It looks better and you get more control over it, and most of the time it does what you want. You're going to need an array to hold the blocks. This will make it very easy to check if it's sorted. |
Author: | Jundu [ Sun Jan 04, 2009 8:34 pm ] |
Post subject: | Re: RE:Can someone please assist me with this =/ |
insectoid @ Sun Jan 04, 2009 8:29 pm wrote: First, GUI = bad. Make your own buttons with Mouse.Where and Draw.Box. It looks better and you get more control over it, and most of the time it does what you want.
You're going to need an array to hold the blocks. This will make it very easy to check if it's sorted. My teacher says we have to use buttons (trust me i wish we didn't) Thanks for the array tip though |
Author: | Insectoid [ Sun Jan 04, 2009 8:36 pm ] |
Post subject: | RE:Can someone please assist me with this =/ |
She said you had to use buttons. Not the GUI ones! Make your own! I'd be willing to bet he/she'd give you bonus marks! Funny how everybody's asking for help the night before school starts again... |
Author: | Jundu [ Sun Jan 04, 2009 8:38 pm ] |
Post subject: | Re: RE:Can someone please assist me with this =/ |
insectoid @ Sun Jan 04, 2009 8:36 pm wrote: She said you had to use buttons. Not the GUI ones! Make your own! I'd be willing to bet he/she'd give you bonus marks!
Funny how everybody's asking for help the night before school starts again... she said specifically GUI buttons plus we've already done the mouse over buttons and my teacher considers it not a real button |
Author: | DarkRider [ Sun Jan 04, 2009 8:52 pm ] |
Post subject: | Re: Can someone please assist me with this =/ |
Well what you need to do is keep calling GUI.ProcessEvent (), which will update your GUI objects (ie. you need to repeat ![]() ![]() I attached a file to demonstrate how to do it (only look at it if you really need to). insectoid wrote: First, GUI = bad. Make your own buttons with Mouse.Where and Draw.Box. It looks better and you get more control over it, and most of the time it does what you want.
You're going to need an array to hold the blocks. This will make it very easy to check if it's sorted. I agree with you, but the GUI module is workable for what he/she wants to do, and less time consuming. |
Author: | Tony [ Sun Jan 04, 2009 8:55 pm ] | ||||
Post subject: | RE:Can someone please assist me with this =/ | ||||
two things -- you need to have GUI.ProcessEvent then inside your main application loop to actually run the code behind the buttons. It's typically done using
though the same loop could have other on-going processes as well. This should be your only loop, as other nested loops will render GUI unresponsive until you get back to that point. also, from your code
GUI.ProcessEvent typically returns false, until GUI.Quit (that might not be exact syntax). So the insides of that if-statement will never be executed (I don't see a Quit button in your code) |
Author: | Jundu [ Sun Jan 04, 2009 9:13 pm ] |
Post subject: | Re: Can someone please assist me with this =/ |
DarkRider @ Sun Jan 04, 2009 8:52 pm wrote: Well what you need to do is keep calling GUI.ProcessEvent (), which will update your GUI objects (ie. you need to repeat
![]() ![]() I attached a file to demonstrate how to do it (only look at it if you really need to). insectoid wrote: First, GUI = bad. Make your own buttons with Mouse.Where and Draw.Box. It looks better and you get more control over it, and most of the time it does what you want.
You're going to need an array to hold the blocks. This will make it very easy to check if it's sorted. I agree with you, but the GUI module is workable for what he/she wants to do, and less time consuming. Thank you so much ![]() How do i make it so that when the button is pressed the first window closes How do i make it so that the blocks i will be making further along in the program can be moved by mouse? |
Author: | DarkRider [ Sun Jan 04, 2009 9:20 pm ] |
Post subject: | RE:Can someone please assist me with this =/ |
I would suggest looking in the Turing reference for more information on what you need to do. You need to look for the Window and Mouse sections. (To access the reference go into Turing and then click on Help -> Turing Reference. After that expand the Turing Language tab and then Predefined Modules.) I don't want to do all the work for you (that file was only to help you if you couldn't get it). |
Author: | Jundu [ Sun Jan 04, 2009 9:25 pm ] |
Post subject: | Re: RE:Can someone please assist me with this =/ |
DarkRider @ Sun Jan 04, 2009 9:20 pm wrote: I would suggest looking in the Turing reference for more information on what you need to do. You need to look for the Window and Mouse sections. (To access the reference go into Turing and then click on Help -> Turing Reference. After that expand the Turing Language tab and then Predefined Modules.)
I don't want to do all the work for you (that file was only to help you if you couldn't get it). thanks for the tip Also thanks for the help everyone! |
Author: | Insectoid [ Sun Jan 04, 2009 9:37 pm ] |
Post subject: | RE:Can someone please assist me with this =/ |
Off topic again- Not a real button? It is just as much a button as a GUI button, with far more options for appearance (only limited by your imagination)and functionality. IIRC, the GUI can only execute procedures, while custom buttons can do anything you want to. As for appearance, you can make anything from a box to a loaded picture to an animation into a button. All you get with the GUI is a boring, ugly gray win9X button. Admittedly, some teachers have odd, possibly dated, opinions. My teacher is against '+=' because he hasn't programmed in 20 years, before that was common to nearly every language. That's just me arguing, do what your teacher tells you but use 'not real yet somehow better' buttons in future. |