Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / clicking an image

Author
Message
Camronas
14
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 6th Oct 2010 06:30
i have a menu at the moment


Yes i know not the prettiest code and its not commented. Anyway iv been trying to make some code that lets me click on an image to take me deeper into the menu or start the game. The site I have been using as a base so far is http://www.tek-tips.com/viewthread.cfm?qid=433215&page=2 but for some reason i get alot of errors. Any help would be great.
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 6th Oct 2010 07:07 Edited at: 6th Oct 2010 07:07


this is very crappy and may not be complete pulled it out of my old code you can modify it fairly easy it use's text but im sure you could change it to images

======================================

GreenDixy Productions http://GreenDixy.Com
Camronas
14
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 6th Oct 2010 09:44
ok i think iv done it write, I get no errors but it still doesnt do anything any ideas?

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Oct 2010 10:09
Quote: "The site I have been using as a base so far is http://www.tek-tips.com/viewthread.cfm?qid=433215&page=2 but for some reason i get alot of errors. Any help would be great."


That message was probably made in 2005. It's best to stay here to get the latest methods on programming in Darkbasic Pro.

Quote: "Yes i know not the prettiest code and its not commented. Anyway iv been trying to make some code that lets me click on an image to take me deeper into the menu or start the game."


The easiest method for menus is using sprites and the SPRITE COLLISION() command. Every selected menu image is a hidden sprite and there is a small sprite at the mouse coordinates (also hidden). You check if the small sprite is colliding with any of the menu sprites and if it is you reveal the hidden menu sprite currently colliding with the small sprite. When not colliding with anything all the sprites are hidden to show just the background image (the menu items in a non-selected state).



Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 6th Oct 2010 22:52
IanM's matrix utilities has a "zone" feature that lets you set up areas that can be trapped by clicking. Since you can number the zones however you like, it's convenient to have the zones match a keypress, for instance if you have a "Load Game" menu choice, you can make it zone 38, to match the keystate for the "L" key.

GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 7th Oct 2010 05:12
@Grog Grueslayer love your code thank you very much works great better then what i was using no offense to original creator

======================================

GreenDixy Productions http://GreenDixy.Com
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 7th Oct 2010 09:40
@ Rich Dersheimer

One of the coolest things about IanMs Matrix 1 Utilities Plugin is that IanM has filled his plugin with so many cool commands it's always fun discovering commands you didn't know were in there. Zone is one set of commands that I glanced at but passed by till you talked about it.

Here's the same code with zones instead:



@ GreenDixy

Thank you. If you want to try the zone version you'll need IanMs Matrix 1 Utilities Plugin. It's chock full of amazing commands that (as you can tell above) even IanMs greatest fan (me) sometimes misses.

http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18

Login to post a reply

Server time is: 2024-09-28 22:29:57
Your offset time is: 2024-09-28 22:29:57