Mouse Movement

Talk about making games.

Mouse Movement

Postby Fenrir » Thu Feb 03, 2005 3:46 pm

How do I make the actor go where I want, using the mouse/stylus?

Grateful for answer! 8)
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby Just4Fun » Thu Feb 03, 2005 4:38 pm

Hi Fenrir:

I'm not sure exactly what you want to do, but you can use the "Follow Mouse" Action to move your actor around the screen with the mouse.

Create your Actor and give it a name like "followMouse".
--->Now, add an event to your "followMouse" Actor.
------->"Create Actor"
---------------> Now, add an action:
---------------------->"Follow Mouse" (A Follow Mouse Dialog Box will open)
----------------------------->Change the Actor to "followMouse"(Actor Name)
--------------------------------> Select OK button & immediate action.

Now run your game. Your actor should now follow your mouse movements around the screen. HtHs...
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fenrir » Thu Feb 03, 2005 4:49 pm

Thanks for the rapid reply. However, what I want to know is how to click with the mouse somewhere in the view, and make the actor go there.
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby makslane » Thu Feb 03, 2005 6:48 pm

You can make this:

- Create an "Filled Region" actor (you can name it sensor), and stretch to cover all view
- On sensor Mouse Button Down event create a Script Editor action and put this code to move the player actor:

player.xscreen = xmouse;
player.yscreen = ymouse;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Fenrir » Thu Feb 03, 2005 7:18 pm

I only get error messages when typing in the code. It says that it can't find the player..
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby Fenrir » Thu Feb 03, 2005 7:24 pm

This is the error I get:

Error: Line 1: Undeclared identifier player
Error: Line 2: Undeclared identifier player
Error: Line 3: Empty function definition
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby Fenrir » Thu Feb 03, 2005 7:27 pm

ok, I got the code, but the player won't move.
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby Fenrir » Thu Feb 03, 2005 7:34 pm

I don't want the player to "teleport" itself all over the screen. I want it to walk to the point on which I have clicked on in the landscape, like in Diablo. :wink:
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby Just4Fun » Fri Feb 04, 2005 4:51 am

Fenrir:
I am still having trouble understanding what you want to do.

If you only want the player to move on the x coordinate, that is, only in a straight line across the screen, then use only player.xscreen = xmouse; in your script. Do not use player.yscreen=ymouse;

I've never played Diablo so maybe moving in a straight line isn't what you want to do either.

Please help us give you a good answer by thinking about what you are trying to accomplish and then writing your question as clearly as possible.

Thanks... :wink:
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fenrir » Fri Feb 04, 2005 9:47 am

ok, I'll try to be more specific.
The player of the game is seen through a top-down view - the game camera is pointing down to the ground, just like in a RTS (Real Time Strategy).
I want my player (human animations) to "walk" to wherever I click in the gameworld. If I click in a point which lies along the x-axis, some steps to the right of my player, I want it to start moving in that direction (showing the animation for the player moving right), and stop on the point of which I have clicked.
If I click on a point in the landscape which lies above the player - along the y-axis - I want it to move in that direction (showning the animation for the player moving up), and stop on the point of which I have clicked.
I also want to be able to click on a point which lies between the x- and y-axis, making the player move diagonaly across the landscape.

What I'm talking about is to...

- Have the ability to move the player to wherever I want in the landscape, using the click of a mouse.

- Have eight directions of which the player can move, thus giving it eight different animations of movement.

- Have the player adjust its "movement animation" to the direction it is moving.

Hope this makes it easier to understand. :D
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby micro » Fri Feb 04, 2005 12:09 pm

Fenrir wrote:This is the error I get:

Error: Line 1: Undeclared identifier player
Error: Line 2: Undeclared identifier player
Error: Line 3: Empty function definition



you MUST make an actor named "player".
if you dont it does'nt work
micR0 was here

visit my homepage: http://micr0.isgreat.tv
micro
 
Posts: 39
Joined: Fri Dec 24, 2004 12:04 am
Location: norway
Score: 0 Give a positive score

Postby Fenrir » Fri Feb 04, 2005 12:35 pm

you MUST make an actor named "player".
if you dont it does'nt work[/quote]

yes, I got that. But my other problems remain!
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby micro » Fri Feb 04, 2005 2:00 pm

I did it easily but I dont know how to make the actor move slow not that fast :?
micR0 was here

visit my homepage: http://micr0.isgreat.tv
micro
 
Posts: 39
Joined: Fri Dec 24, 2004 12:04 am
Location: norway
Score: 0 Give a positive score

Postby makslane » Sat Feb 05, 2005 3:46 am

Use the MoveTo action
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Fenrir » Sat Feb 05, 2005 9:23 am

makslane:

Could you please guide me through a step-by-step, I can't get it to work. The player is "teleporting" to where I wan't it. I wan't to have the player "move" towards that point.
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest