Menus
Blitz3D Forums/Blitz3D Beginners Area/Menus
| ||
http://h1.ripway.com/fox95871/index.html Could someone please fix this, it's 90% done. I want it to: 1. Not show the file menu for one frame when you let go of quit. I want it to go straight from blue to black, not from blue to gray to black like it's doing now. 2. Actually quit. I've tried everything I can think of, but I can't seem to make releasing a mouse button do something. I've deactivated the code that didn't work. I would also like to know how to make the cursor start at the center of the screen or anywhere else I want it to, but that's secondary. The code for the menu starts at the label .filemenuevents Thanks, hope someone here can help. |
| ||
I'll need to spend some time looking through your code to come up with an answer for the first two questions, but I Do have an answer for making the cursor start where you want it to. At the begining of your code when your setting the cursor position, use the MoveMouse command. It repositions mouseX() and MouseY() to a position of your choosing using x and y coordinates. Use it like this. MoveMouse 400,300 This would position the mouse cursor in the middle of the screen. Good luck to you, and I'll post again if I come up with an answer for your other problems. |
| ||
After going through your code I've determined the problem. this was the line of code that was meant to quit the program, but didn't work. If Not MouseDown(1) And quitswitch="ready to quit" And ImagesCollide(cursor,cursorposition,cursorheight,0,quitarea,0,0,0) quitswitch="quit" EndIf The reason this didn't work, is because this is almost exactly the same to the line of code above it. All thats differern't is the event that happens. If Not MouseDown(1) And quitswitch="ready to quit" And ImagesCollide(cursor,cursorposition,cursorheight,0,quitarea,0,0,0) quitswitch="not ready to quit" EndIf I tried several ways to fix this, but to no avail. I think the main problem is with your program in general. It would work better, if you modified it so instead of moving down to the file option you would like to pick and letting go of the mousebutton, you made it more like the files menus on your computer. Where you go over to the file option, click on it, and then scroll down the list of options and click on the one you want. And then the filemenu will disapear, either when you move the mouse off of it, or move the mouse off of it and click. So what I suggest you do, is look at how the file menus work on your computer, and try to copy it. If you need any more help, than I would be happy to aid you. Kind Regards, and Good Luck, The Mighty WERDNA(Lord Of Darkness) |
| ||
It's an exact copy of the file menu on my computer now actually, though photoshopped a bit. But everything else is identical basically, even the way the menu doesn't disappear when you leave the area as long as you're still holding down the mouse button, but the blue highlight does. I can't make it look or act any closer other than the two problems I mentioned. Thanks for trying though. I was pretty burnt out from working on it so much, so an outsider's perspective was helpful. I didn't even notice those two lines were so similar because I was juggling so much at once. By the way, your mouse idea worked perfectly. I was thinking, would breaking things up into functions help at all, or would that just complicate things too much? It seems like maybe the gray frame problem, and the whole not quitting problem might be caused by there being too many things in one part of the program that could contradict each other. That's not to say I have any idea how to write functions that would fix the problem, but I am at present accepting suggestions/helpful code snippets/the whole thing revamped...or whatever. |
| ||
Functions are definetly a good idea. I always find that anything you can do with a label, you can do much better using a function. Functions help keep your code much cleaner, and easier to understand. And I believe that you are correct, that those problems were caused by there being too many things in the main loop of your program. Its a good idea to keep your programs main loop as small as possible. Just include a few basic things, like drawing images, and have functions take care of the rest. ;Example Of How The Main Loop For My Programs Usually Looks. While Not Keydown(1) Cls;Clear the screen Drawimage PlayersImage Drawimage BackGroundImage MovePlayer();The function that moves the player MoveEnemys();The function that moves the enemys Flip Wend |
| ||
Alright, I'll try. Functions still confuse me right now though. It seems like every time I've tried to make one in the past, everything else in the program that was working before got messed up, and I don't think it was because I wasn't using global and local right either. Would having almost everything be a function fix that? |
| ||
Get into the habbit of using functions now or you will be in a world of confussion with much larger programs. |
| ||
Okay, I fixed it. Thanks for all the help. http://h1.ripway.com/fox95871/index.html |
| ||
Np, If you need anymore assistance with your games, please feel free to post and I'll see what I can do. |