Page 1 of 3

Point and Click Game

PostPosted: Fri Sep 12, 2008 10:15 pm
by GuybrushThreepwood
I'm making a game and want to make the movement so that when the mouse is clicked, the actor moves to where you clicked. How could I do this with as little scripting as possible?

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 12:30 am
by BlarghNRawr
ummmmm...
put a filled region over the whole screen

then, mouse button down
move actor to mouse positon

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 8:26 pm
by GuybrushThreepwood
That worked, but how do I make the animation change to left if I click on the left side of him and change to right on the right side of him?

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 9:50 pm
by BlarghNRawr
i would put 2 more filled regions on both sides of him, and then parent them to ur moving actor, then if you click the left one, change animation to charleft and change animation to charleft for the right one
WARNING: this is just my way, there is probably a MUCH easier way

(on an unrelated note... how do i pronounce your name?)

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 10:03 pm
by GuybrushThreepwood
Guy(Like a person)Brush(Like a paint BRUSH)Threep(Like the #3 with a p)Wood(Like a log)
Guy-Brush Threep-wood
Guybrush Threepwood

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 10:04 pm
by BlarghNRawr
:lol:

so did it work?

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 10:59 pm
by GuybrushThreepwood
Ya but how do I make the animation stop after he's done moving?

Re: Point and Click Game

PostPosted: Sat Sep 13, 2008 11:02 pm
by BlarghNRawr
hmmmm...

Re: Point and Click Game

PostPosted: Sun Sep 14, 2008 11:26 pm
by edh
You'll need to do some scripting eventually.

Here's a simple approach to get started. You will probably end up with some "moon walking" unless you do something clever.

To make the actor follow the mouse, create a canvas which is larger than the view.
Add an event to the canvas: mouse button down, left button.
Add action: move to, select the actor you want to move, relative to mouse position.

Run that. You actor guy should move to wherever you click.

To make the character animate and then stop once he has reached his position, do this.
Add an event to the actor, move finish.
Add action: change animation to whatever the stop animation is.

You're going to need code though. You will want to detect where the mouse x and y are so you can choose which animation to use (Walk North, Walk NE, Walk E, ...) and which animation to stop on (Stand North, Stand NE, Stand E, ...). In that case, you would choose script events for everything and make the right function calls from the script instead of the editor interface.

Re: Point and Click Game

PostPosted: Mon Sep 15, 2008 1:04 am
by BlarghNRawr
i knew there was an easier way :lol:

Re: Point and Click Game

PostPosted: Mon Sep 15, 2008 1:18 am
by edh
Yeah, the canvas is really the way to go, from what I experimented with. As the view changes you can move the canvas, too.
The first hard part is the animation. Then it starts to get more complicated fast. It won't be long into it before you need to use scripts to do all this.

Re: Point and Click Game

PostPosted: Mon Sep 15, 2008 3:02 am
by edh
Here, I just threw this together as an example. The actor has 8 directions. The moonwalk might not be so bad if I hadn't put the feet in there.

screenshot.png
The actor goes to the location of the mouse click. The demo chooses an appropriate animation direction for walk cycle and ends with the actor in the appropriate standing direction.

edh-follow-mouse.zip
EDH Follow Mouse example.
(236.95 KiB) Downloaded 193 times

Re: Point and Click Game

PostPosted: Mon Sep 15, 2008 10:51 pm
by GuybrushThreepwood
I tried it, but all that happened was when i started, the animation only changed to my right animation

Re: Point and Click Game

PostPosted: Tue Sep 16, 2008 12:45 am
by edh
I'm sorry, I don't understand. Do you mean you downloaded it, ran it and it didn't animate correctly? Or you changed it and it didn't animate correctly?

Can you explain more. I'll try to help.

Re: Point and Click Game

PostPosted: Tue Sep 16, 2008 1:38 am
by GuybrushThreepwood
Yours is like a birds eye view, and mines like side to side scrolling, so when I tried your way, it had one animation for all directions, and didnt stop