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 / mouse driven character movement

Author
Message
ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 9th Jun 2003 04:12
i was wondering if it was possible to controll a player character by clicking on the screen and having the character move to the position that you clicked.

i think that it might have something to do with the vector3 data type
but i have no idea how to accopmlish this.
if any one could help me i would be very greatfull.

MASTER
ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 10th Jun 2003 06:14
hello is any one out there that can help me ?

surly some one can push me in the right direction!

ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 12th Jun 2003 03:01
Does any one in this forsaken world know how to help me!

Inkybro
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Where I live :)
Posted: 12th Jun 2003 05:37
Yeah it's possible, and probably fairly easy, but since I know none of DB I guess I can't answer how, sorry, just be patient, someone will help

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Jun 2003 11:04
more information is required for people to answer you correctly.

A classic mistake is not to include if its 3d or 2d or some weird camera setup description like some game your trying to emulate in control.

Nilrem
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 12th Jun 2003 12:08 Edited at: 12th Jun 2003 12:10
If it's 2D (though for some reason I think it's 3D), then you could try something like:

This won't move the character diagnolly though as I don't know how to do that yet.

I hear and I forget. I see and I remember. I do and I understand.
Yuri
21
Years of Service
User Offline
Joined: 12th Jun 2003
Location: Italy
Posted: 13th Jun 2003 13:46
If it's 2d (like a point 'n click adventure) it is done like this:

you have the coordinate of the starting position and when you click you can get the destination coordinates... simple?

then you can move the object using little steps and checking if an axis coordinate is reached

until the final coordinate is reached.

if the clicked point is out of range (example you have a scene with a ground and a sky and someone click on the sky)
you could use walk areas, you check if the clicked point is in the walkable area, if not you move the object until it reach the border of the walk area.

if the problem is 3d i can't help... sorry..

CBMZone main administrator
http://www.cbmzone.com
Uriel The Ignoble
21
Years of Service
User Offline
Joined: 13th Jun 2003
Location: In a tiny box in the attic
Posted: 14th Jun 2003 03:02
If the game is 3d, you could try hiding the mouse, and make the mouse control a 3d-mouse pointer instead. make the 3d-mouse stuck to the ground matrix. Make your click set a coordinate and have the character move toward it.
Idunno if this helps or is possible tho, i couldn't code it :-p
if it doesnt help then.. ill shutup! sorry!

ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 15th Jun 2003 13:00
ok thanks for the replies, in relation to the 2d answer i have already done this in anothe game that i made.

what i really need to know is in the 3d world
i have a 3d model loaded for the main character and its on a .x map (sliding collision). what i want to accive is to click some where on the map model and have the player move to the position that the mouse clicked on the map(not the x and y co-ords of the screen)
the game is 3rd person and the camera is set up for an isometric view.

any suggestions

MASTER

Pyromaniac
21
Years of Service
User Offline
Joined: 8th Jan 2003
Location: United Kingdom
Posted: 16th Jun 2003 20:28
Yeah, im looking for this type of movement system too.
Since the 2d coordinates of the mouse and 3d coordinates in the 3d field are different, i have no idea how i can acomplish this

thanks in advance for the help ^_^

Screw the rules! What can I blow up???
comic book guy
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 16th Jun 2003 23:13
i made this
hope this is what you mean.
Yian
21
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 17th Jun 2003 01:50
yo comic book guy I got some questions about your code. Pretty smart though..

comic book guy
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 17th Jun 2003 18:48
What is your question?
Pyromaniac
21
Years of Service
User Offline
Joined: 8th Jan 2003
Location: United Kingdom
Posted: 17th Jun 2003 19:42
That code is very good, but it only works in an isometric view (which is what Master wanted anyway ) if you rotate the camera, the coords get all messed up

Could someone please explain how i can modify this code (or build from scratch for that matter ) so that i can position my object on the 3d field no matter what my camera rotation is?

thanks ^_^

Screw the rules! What can I blow up???
comic book guy
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 17th Jun 2003 20:29
i think it wil work if get the rotation angle of the camera.
if the angle is between zero and 90 mouse move x and mouse move y should increace and decrease the x# and y# value as now

if the angle is between 90 and 180 mouse move y should inc and dec the x# value and mouse move x should inc en dec the y# value

if the angle is between 180 and 270 the same as zero-90 but inverted.

and between 270 and 360 the same as 90-180 but inverted.

i don't have time right now to make the code but i think this might work

i'll try to make some code tomorow.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 17th Jun 2003 21:40 Edited at: 17th Jun 2003 21:41
Look in another topic, I think it's a 3dmouse one. I'll find a link. I posted an example there.

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 17th Jun 2003 21:41
Here http://www.darkbasicpro.com/apollo/view.php?t=11835&b=7

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....

Login to post a reply

Server time is: 2024-11-24 18:49:06
Your offset time is: 2024-11-24 18:49:06