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 On An Object Does Something

Author
Message
Pal
21
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 4th May 2003 15:59
ok i load an image. I place it somewhere in the screen. I want my program to perform something when the user clicks on the image on the screen. How do i do this?
I am da man! Beware of my LAZER EYES!
alanuk
21
Years of Service
User Offline
Joined: 25th Mar 2003
Location: United Kingdom
Posted: 4th May 2003 16:47
Try this. You obvously know the position of the image if you put it there so.........

If mouseX()>=left and mouseX()<=right and mouseY()>=top and mouseY()<=bottom then .........do something.........

left right top bottom are the image boundaries in screen positions.

Hope that helps

regards Alan
Drunken idiot
21
Years of Service
User Offline
Joined: 8th Mar 2003
Location:
Posted: 4th May 2003 17:03
I think it will help, at least for a static cube somewhere
on the screen. But what about a human model walking in a 3d map?
Any tips for the code of selecting this model and doing something
after selecting?
(e.g. selecting a unit in a Command and Conquer clone)

Obviously now there are no fixed coordinates available.....

Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 4th May 2003 17:48 Edited at: 4th May 2003 17:49
You probably need to use the sort of confusing 3D maths DB normally prevents you from needing to use.

Visit the new Madd Matt Games Website
http://www.madamattgames.o-f.com/index.htm
Home of Witch Bomber,Magic Cube and Pinball Football(and a lame website)
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 4th May 2003 18:33
or you can use object screen x and object screen y to find the position of the object and then compare that with the position of the pointer and then add/subtract some value from the x/y values to give the selection zone for the object, if you have the object move further away from the camera then use pythagoras to find the distance to the object and modify the size of the selection zone by the distance from the camera, IE: make it smaller as the object moves away, retail games like Warzone 2000 and Total annihilation use the same method to select units, cheers.

Mentor.

Pal
21
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 4th May 2003 20:39
don't confuse me mentor
lol

I am da man! Beware of my LAZER EYES!
Pal
21
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 4th May 2003 20:41
alanuk is it possible for the program to detect if the image has been clicked? Can u gimme an example of ur previous answer

Quote: "If mouseX()>=left and mouseX()<=right and mouseY()>=top and mouseY()<=bottom then .........do something........."



it would be good

I am da man! Beware of my LAZER EYES!
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 4th May 2003 23:06
DBPM heres a snipet where you can click on the image it tells you it has been clicked waits for you to press a key then repositions the image.


ARE YOU A 3D MODELER??? IF SO WE NEED YOU!!!
EMAIL mynameisnoneofyourbuisness@hotmail.com to work on the new Star Strike project!!!
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 5th May 2003 03:34
There's an object screen X command? Now you tell me!
Is there anything confusing DB doesn't protect you from? Superb!
I think I might remake witch bomber 3D now to add the thing I gave up on because I didn't know how to click on an object!

Visit the new Madd Matt Games Website
http://www.madamattgames.o-f.com/index.htm
Home of Witch Bomber,Magic Cube and Pinball Football(and a lame website)
TogaMario
21
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 5th May 2003 04:02
Er, yeah, tried gravity without rapid bouncing or complex .X collision yet? I.E. building you can enter with floor, wall, and ceiling collision, not to mention stairs and multiple levels?

P.S. This is what the alphabet would look like if Q and R were eliminated.
Pal
21
Years of Service
User Offline
Joined: 13th Apr 2003
Location:
Posted: 5th May 2003 07:53
Red_Eye thanx

I am da man! Beware of my LAZER EYES!
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 5th May 2003 17:09 Edited at: 5th May 2003 17:10
What are you on about TM?
These things are all confusing but you don't need to use formulae like


horvel=(1/tan(newdir)+1)*((vecvel^2)/((tan(newdir)/(tan(newdir)+1))^2+(1/(tan(newdir)+1))^2))^0.5


vervel=(tan(newdir)/tan(newdir)+1)*((vecvel^2)/((tan(newdir)/(tan(newdir)+1))^2+(1/(tan(newdir)+1))^2))^0.5


I made these formula for a game when using VB but then I got DBPro and found I could just use newxvalue and newzvalue! - and that wasn't even a 3D game!!!

The things you mentioned were examples of hard programming problems. Obviously DB isn't going to make programming easy for you, but you don't need a University level knowledge of 3D maths.

Visit the new Madd Matt Games Website
http://www.madamattgames.o-f.com/index.htm
Home of Witch Bomber,Magic Cube and Pinball Football(and a lame website)

Login to post a reply

Server time is: 2024-09-20 08:07:29
Your offset time is: 2024-09-20 08:07:29