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 / Bloody linking again!

Author
Message
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 16th Aug 2005 01:24
I still cant get the hang of linking my buttons. This is my Code.


I want to make it so when the cursor goes over the image it changes, (mouseover) and then i can press it and it does a gosub command such as play game. I have tried doing it with the exit button first, cant get it to work! Its driving me crazy!!

http://www.Bevansfunbox.com
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Aug 2005 03:29
You could start with this:

http://forum.thegamecreators.com/?m=forum_view&t=59061&b=7

The only difference between clicking a button and 'mouseover' is the fact that the mousebutton isn't pressed (Mc=0) and that you paste a different image at the co-ords of the relevant button.

Should be easy enough to convert the DB code that this program writes for you.

TDK_Man

master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 16th Aug 2005 05:03
In your code Ad87Am, change the mouseclick()=1 to mouseclick()=0

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Aug 2005 05:17
That won't help really mp as he doesn't understand the idea of screen co-ordinates. For example, you can't have .21 of a pixel!

Like I said Ad87am, take a look at the program I gave you the link to and it will make more sense to you. You can look at the dba code it produces.

TDK_Man

Kim Possible
19
Years of Service
User Offline
Joined: 13th Aug 2005
Location: Where ever there\'s trouble.
Posted: 16th Aug 2005 05:47
>> For example, you can't have .21 of a pixel!

With the video cards of, you kinda can. Subpixel sampling is the staple of modern antialiasing... Quarter-pixel is a standard.

DBP + VC Ent.Studio | Maya, MAX, Soft3D, MilkShape, Character FX | 3.0Ghz P4, IC7G, GF 6800GT (primary) / 3200XP, A7N8x, GF 6600GT (secondary) / 6x dual 2.8Ghz Xeon SuperMicro (renderfarm)
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Aug 2005 15:31
Kim Possible:

Even with modern graphics cards, your monitor still has the whole pixel as the smallest unit. You cannot turn pixel 12.75 to green and in 800x600 screen mode, you can't have more than 800 pixels across the screen.

OK, graphics cards can pretend that fractions of a pixel exist during image processing, but they don't physically exist, so I was just pointing out that you shouldn't reference them in DB.

MouseX() and MouseY() return integers and for example, the Point command:

Quote: "
POINT
This command will return the pixel color value from the the screen at the specified Coordinates. The parameters should be specified using integer values. You can also read from bitmaps by using the SET CURRENT BITMAP command.

SYNTAX
Return Value=POINT(X,Y)
"


TDK_Man

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 16th Aug 2005 20:33
I have got the buttons working tanks to that program, thanks a bunch for that, really helped me out. How do I make mouseover when the curser goes over the button?


I have tried putting then after and then Paste image 11,625,425 but then i have to get rid off the End if and then it dont work atall.

http://www.Bevansfunbox.com
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 16th Aug 2005 20:38
Oh and also I want to make a sound happen when i click, such as a click noise.

http://www.Bevansfunbox.com
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Aug 2005 21:39 Edited at: 16th Aug 2005 21:42
The idea of If..Then statements is that they make boolean decisions - in other words yes/no questions. Does A=1? Yes or no - it can never be 'maybe'.

If your parameters return True then IF..Then will do what you ask it to.

You also have 'Else' so if your conditions fail, then you can list the instructions to do as an alternative.

Your problem is that you want it to do two things:

1. Mouseover image - when the mouse is over a button but no button clicked.

2. Select button - when the mouse is over a button and the button is clicked.

The thing they have in common is the 'over the button' aspect, so we have one If..Then which checks the mouse position and inside this, we have another which checks the button status. This is called nesting.

The code would look something like this for ALL buttons, (not tested but should work fine)...



By the way - forgot to mention. The variable PutImg1 is for this button only. You need PutImg2 for the next button, PutImg3 for the next and so on.

TDK_Man

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 17th Aug 2005 00:19
The code works, but when i put my mouse over it, it does not change untill i click it, and it does not change for long, what i think is happening is that because i have pasted the normal image in so i can put it anywere on the screen i want, and when i put this mouse over code in, i think it is going behind the image so i cant see it very well, is there a code to bring the mouse over to the front or send the normal to the back?

http://www.Bevansfunbox.com
Zone Chicken
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 17th Aug 2005 00:46
Haven't read all of the above so sorry if this is way off, but wouldn't it be easier making your buttons sprites and a hidden sprite to mousex and y hidden to check collision, as for not changing long you may need to use a timer to display or do whatever you want for a length of time after the click.

load image "button.jpg,1
sprite 1,100,100,1
load image "mousechecker.jpg,2
sprite 2,mousex(),mousey(),2

do
sprite 2,mousex(),mousey(),2
if sprite collision(1,2) and mouseclick() = 0
do whatever
if sprite collision(1,2) and mouseclick() = 1
do something else
endif
endif

loop

Your signature has been erased by a mod -- please resize to under 600x120...
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 17th Aug 2005 00:49
I have already got all the butotns working and stuff, just gotta make the rest of the script and link them with gosubs, sound works greate, but the mouse over dont seem to work, i think it may be because the normal image is infront and the mouse over image is behind it when show, u can only see a flicker of the mouse over when the button is pressed

http://www.Bevansfunbox.com
Zone Chicken
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 17th Aug 2005 00:59
Maybe repaste your mouseover image if the mouse is over the button and repaste your button if the mouse is not over it don't images display in order of pasted to the screen(can't remember)?

Your signature has been erased by a mod -- please resize to under 600x120...
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 17th Aug 2005 01:23
I dont think i can do that, here is my script


I tried to take out the paste image commands at the top that put the button in (not the one in the linking buttons and mouseover code) hoping that it would work because if mouse is not over it, it should be displaying the normal image, but it didnt work.

http://www.Bevansfunbox.com
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 17th Aug 2005 01:27
I dunno, Im going to bed, getting tired of all this programming for one day, been making music too on fruity loops!

http://www.Bevansfunbox.com
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Aug 2005 03:21
Ad87am:

Try reading my post again. You didn't do what I said.

TDK_Man

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 17th Aug 2005 19:41
I cant figure out what i have done wrong

http://www.Bevansfunbox.com
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Aug 2005 03:42
Quote: "one If..Then which checks the mouse position and inside this, we have another which checks the button status. This is called nesting."


In my example I used:

If Mx>627 And My>431 And Mx<782 And My<504

You have in your code snippet:

If Mx>23 And My>295 And Mx<399 And My<373 And Mc=1

Spot the error?

You didn't move the testing for the mouse click inside the mouse position If..Endif did you?

TDK_Man

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 19th Aug 2005 01:10
Ah i see now, i got the mouse click in there, didnt notice that, thanks, it works now.

http://www.Bevansfunbox.com
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Aug 2005 20:45

Login to post a reply

Server time is: 2024-09-24 03:20:43
Your offset time is: 2024-09-24 03:20:43