playMaker

Author Topic: Move To with Mouse Click  (Read 2365 times)

Wayne191

  • Playmaker Newbie
  • *
  • Posts: 28
Move To with Mouse Click
« on: April 25, 2017, 12:15:54 AM »
Hi,

If I have 5 items A,B,C,D,E. I want to move item A to B,C,D or E. (player's choice with mouse click) How can I do it?

So the player will mouse click on A first and then click on his choice of B,C,D or E. Item A will then move to B,C,D or E.

I know I can use Mouse Pick Event to click on item A, but how can I make item A move to B,C,D or E based on the player's choice?

Thank you.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Move To with Mouse Click
« Reply #1 on: April 25, 2017, 03:22:41 AM »
I am actually working on a tutorial for this. Or pretty darn similar (enough that you could get the solution). I am using a similar mechanic in my game. In mine, I click on a character (could be an object). It then selects the object. Then I click on the screen and it goes to that location (rather than to a specific object). My game has various characters, so you can choose which one you want to move in this fashion.

Mine also has a different state for hover over (like highlight object), one for click (like a special sound for clicking on something you can move).

Ill likely be done in a day or two. I can post here when finished if you would like.

Wayne191

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Move To with Mouse Click
« Reply #2 on: April 25, 2017, 05:29:54 AM »
That would be awesome. Thank you for your help! Looking forward to it.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Move To with Mouse Click
« Reply #3 on: April 25, 2017, 07:12:34 AM »
No problem. I was working on it myself for my own project. Hopefully this video should help.

In this playmaker tutorial I show how to create clickable objects to select and then click a second time on the screen to move to this new location.

We also look at:
- movement with or without navmesh
- mouse over/exit/click/unclick sound effects or color effects
- how to limit click destination selections
- send events over more than one fsm
- how to use this with one or many game objects
(second half of tutorial talks about navmesh movement)

Join us on slack for chat: https://invite-playmaker-slack.herokuapp.com
Link to Ecosystem Download: https://hutonggames.fogbugz.com/default.asp?W1181

« Last Edit: April 25, 2017, 07:14:16 AM by tcmeric »