Computer Science Canada Problems with Menu |
Author: | uberwalla [ Sun Nov 19, 2006 9:00 pm ] |
Post subject: | Problems with Menu |
ok, so i'm making a game (not being disclosed at the time which it might be), and im trying to make a menu for it. ive made the buttons// wrote the code but i can't get it so that when u select a button that it goes over it with the different color button to show it is being looked over (not yet clicked though). all is included in the attachment im adding, any help would be great. - i'm mainly looking for how to have it so that the green buttons (when pressed) dont flash so that u can't see them. thx in advance. |
Author: | Clayton [ Sun Nov 19, 2006 9:26 pm ] |
Post subject: | |
just have a simple check to see if the mouse is over the button (but not pressing) then have the button drawn in a different color. really, this kind of problem isnt that hard to figure out, it almost feels like no one is putting any effort into thinking about the problems that they come up to when it's time to solve them. |
Author: | uberwalla [ Sun Nov 19, 2006 9:46 pm ] |
Post subject: | |
well im not actually using the mouse in this, i think i forgot to say that :S im using arrow up/down. but i think ill try the mouse idea, yet i have never used it b4 lol thx. |
Author: | neufelni [ Sun Nov 19, 2006 10:12 pm ] | ||
Post subject: | |||
What you could do is make a variable for your position in the menu. So if you have 4 menu options you would use something like this:
|
Author: | uberwalla [ Sun Nov 19, 2006 10:25 pm ] |
Post subject: | |
ok i dont quite understand that nick... lol where do the blue and green buttons come into play. im not saying for u to write my whole code over or w.e obviously but... im asking if i still start with blue buttons then where u have (draw button 1 different color ) thats where green goes? and \where should i put the end if? at end of it all and add elsifs? |
Author: | ericfourfour [ Mon Nov 20, 2006 12:10 am ] |
Post subject: | |
If you know records just make a list of buttons and have one member of the record be the colour. Then have a variable that keeps track of the selected button. If the button is selected change the colour. |
Author: | uberwalla [ Mon Nov 20, 2006 12:24 am ] |
Post subject: | |
ok, thx i think i get what ya mean with the records. and i was wondering if i could also get help with mouse part with the menu. i think it would be more effciant. if possible i would like to know if u can have the button change color by just going over it in turing and not clicking right away. and if it is possible if someone could guide me in the right direction |
Author: | Clayton [ Mon Nov 20, 2006 10:36 am ] |
Post subject: | |
ugh... I already told you it was possible to do this, just read my first post and you will be fine, think for yourself, it's not even hard, use pencil/pen and paper, plan it out, think. These skills are extremely important for someone to be a good programmer, because you have to be able to problem solve. |
Author: | uberwalla [ Mon Nov 20, 2006 3:55 pm ] | ||||
Post subject: | |||||
ok well, im sorry for acting needy and such, but i have indeed done the research. and i do understand the basic concept of mousewhere and stuff but i was wondering if there is an easy way of doing it. as in:
is that possible in a sence? i tried it and it didnt work. but is there a way to call upoon the picture so it gives the coordinates instead of saying
sorry for this blablah blah talk but i would really like some help, and am really eager to learn. plz could i get an example for one of my buttons at least or a general idea. again im not saying do it all cuz thats no fun i need to try to learn [here i go again blabbing ] ok ty for looking///reading |
Author: | uberwalla [ Mon Nov 20, 2006 3:56 pm ] | ||||
Post subject: | |||||
ok well, im sorry for acting needy and such, but i have indeed done the research. and i do understand the basic concept of mousewhere and stuff but i was wondering if there is an easy way of doing it. as in:
is that possible in a sence? i tried it and it didnt work. but is there a way to call upoon the picture so it gives the coordinates instead of saying
sorry for this blablah blah talk but i would really like some help, and am really eager to learn. plz could i get an example for one of my buttons at least or a general idea. again im not saying do it all cuz thats no fun i need to try to learn [here i go again blabbing ] ok ty for looking///reading |
Author: | uberwalla [ Mon Nov 20, 2006 7:58 pm ] |
Post subject: | |
ok first of all id like to sincerely appologize for: 1) kind of being stubborn when all of u are leading me in the right direction and me not really noticing 2) double posting and now tripple (one of the posted posted double for some reason) anyways as ive been trying and trying a lot today to figure this out i did get it earlier but did post cuz i was trying to solve this next problem i had which i also had with the other version with the arrow keys. in this one for some reason only the start button highlights, and also it flashs weirdly to the point u cannot see it green really. help is awsome and very appreciated. if someone could show me what i can do better with my coding/// help me fix this problem that would be awsome. p.s. i would also like to thank freakman, ericfourfour, and nick for ur guys help so far. more help would be great because i to u |
Author: | neufelni [ Mon Nov 20, 2006 10:40 pm ] | ||
Post subject: | |||
uberwalla wrote: ok i dont quite understand that nick... lol
where do the blue and green buttons come into play. im not saying for u to write my whole code over or w.e obviously but... im asking if i still start with blue buttons then where u have (draw button 1 different color ) thats where green goes? and \where should i put the end if? at end of it all and add elsifs? Sorry, I'm used to Python where there are no end ifs, so I guess I just forgot them. Also, what I had was just pseudo code. The problem with the button flickering when the mouse is over it is because you redraw the button blue every time through the loop. You only want it to draw all the buttons blue when the mouse is not over any buttons, so I changed all the if statements into one if statement with elsifs and an else. I also changed some of the y values in the if statements. Here is the modified code. If you have questions about it, just ask.
|
Author: | DemonZ [ Tue Nov 21, 2006 1:31 am ] | ||
Post subject: | |||
I think I have a similar solution to the same problem, so forgive me for mentioning it. any way all I did was change all your if statements to one giant if structure and added an else at the end, then put all the blue buttons in the else, that way anything other than the parameter check on the buttons will change the color of the buttons back into blue. Heres ur code back its fixed now, I really didnt mean to do it for you but I figure it was the quickest way.
|
Author: | uberwalla [ Tue Nov 21, 2006 8:02 am ] |
Post subject: | |
wow. ty so much guys, i understand. i was thinking of making the blue buttons outside the loop, but then i woulda had to call on it with another loop or something. ok thx a bunch. |