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 / Needing help with coding...relating to button images/mouse coding

Author
Message
cryson101
10
Years of Service
User Offline
Joined: 22nd Jun 2014
Location:
Posted: 23rd Jun 2014 00:58
so as a complete beginner to darkbasic pro, I thought I would try various things in my attempt to learn everything needed to make game.

One of the things Im trying to learn to do, is make it
so that something happens ONLY when you click the mouse within a certain area of the screen.

Iv made various attempts, with what seemed like legit coding, and while the coding had no syntax errors, I wasnt able to achieve what I set out for. I can make music play, or the screen change to another image, but its not only when the mouse clicks within a certain area.

Could anyone please help me with this? Would really appreciate it.
Maybe an example of coding, or an explanation, of how I can get somehing to happen only when a certain area on the screen is clicked within. Thanks
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 24th Jun 2014 14:05
Hi cryson. Here is an example of what I think you are trying to achieve.


I hope the comments explain how the code works, but if you have any questions about it, please feel free to ask. If possible, post your own code with your questions too so we can show you why what you've tried so far isn't working and how to fix it. Anyhow hope that helps .

cryson101
10
Years of Service
User Offline
Joined: 22nd Jun 2014
Location:
Posted: 28th Jun 2014 04:20
yes that helped quite a bit thanks, my own coding attempts werent actually that far off from that example, I guess I was just using the wrong commands or was using them in the wrong way.

I do have a question though. In your example, you used the drawing command, the one that draws the box. What I was wondering, is it possible to do the same thing, or same idea with lets say...an image or a sprite? (not sure which one it would be)

What Id like to be able to do is make I guess a drop down menu, and I wanted to use an image, like a button or something, so that when you click in that button it loads another image right below the button, I guess that would be the drop down menu with all the options?

Im not even sure if thats how you would go about making a drop down menu, but in my head it sounded right lol
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Jun 2014 19:15 Edited at: 28th Jun 2014 19:15
Quote: "What Id like to be able to do is make I guess a drop down menu, and I wanted to use an image, like a button or something, so that when you click in that button it loads another image right below the button, I guess that would be the drop down menu with all the options?"


Yes, there are a few commands for handling that. I'd recommend paste image or paste sprite.

You should always load all of your resources before the main loop begins, because it's a slow and inconsistent process.



cryson101
10
Years of Service
User Offline
Joined: 22nd Jun 2014
Location:
Posted: 30th Jun 2014 21:28
just wanted to say thanks, between both of your replies, I feel now that Iv got a better understanding of how to make my menus for my project.

So far, I can make a drop down menu, and have something happen when I click on the drop down menu itself. That is more then I was able to do when I first started with darkbasic pro.

Login to post a reply

Server time is: 2024-11-23 14:20:52
Your offset time is: 2024-11-23 14:20:52