Making A Button
Blitz3D Forums/Blitz3D Programming/Making A Button
| ||
yo! I'm making a game called Ire and i needed to know REALLY BADLY if anyone knows how to make it to where my cursor (which is an image following my mouse's x and y) could click on another image and start an action (i dont mind what,you could just make it exit if you want). ___________________________________________________________ |
| ||
Ok, below should help you. It takes the mousex() and mousey() co-ord, with a width and height of 1, to give the point/cursor an action point. Depending on your image this might not be good enough. Depends on what part of the cursor you want to actually do the selecting. Anyway, look at the rectsoverlap command. Takes a first x,y cord then first width, and checks for overlaps with a second x,y and height and width. The If checks first for a keypress THEN checks for an overlap. If Mousehit(1) then ; if left click ; BELOW \/ if the mouse co-ords, overlap the images dimensions (NOT pixel perfect) If rectsoverlap(mousex(),mousey(),1,1 , image_x,image_y,imagewidth(image),imageheight(image) ) then ;Perform action here End if End if |
| ||
Little tip, to, making a MMORPG is extremely tough work. Might want to learn some of the basics first :o) good luck |
| ||
yeah, i know...lol(?) dude, thanks! it took a little tweaking because i was trying to use the image as a sprite so i could make an effect where i make my camera move backwards after a selection and they disappear through fog but i can work around that, ive been trying to get this for months!!! txs! hey, just one more question, do you know how to make the image stop flickering? its doing that because of the flip command but i cant get rid of it or else i wont see my pointer. any suggestions? |
| ||
I assume your using double buffering? If not, then you should be :o) your loop should, if using 2d look like so: LOOP Cls draw_stuff draw_pointer flip END LOOP That's if your doing 2d. If your doing 3d, i have no idea. You can post the code of your main loop if you wish. |
| ||
the flickering problem could be a z-order issue. if you've got an image thats exactly on another image and they have the same z coordanate then you will get this problem. |
| ||
k, txs. i just figured it out. for some reason, where i put the flip affects how it reacts (ill have to come back to it) |
| ||
Flip should be right at the end of your loop. |