Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Izzi on May 14, 2018, 03:34:15 PM

Title: Click-to-move - 2D - Top down
Post by: Izzi on May 14, 2018, 03:34:15 PM
Hello,

I have recently started using Playmaker, I want to move a sprite where I click.

So far:
(https://i.imgur.com/L998nEI.png)

State IDLE:

Action - Get mouse Button Down (Left)
Send Event - Mouse Click
Action - Get Mouse X
Action - Get Mouse Y
Action - Set Vector 3 XYZ (Get Mouse X, Get Mouse Y, none)

State Move to:

Action - Move Towards (Target Position: Vector 3 XYZ from IDLE State)
Event - FINISHED

The result is not so great ... The sprite does not move correctly, like there were "invisible walls" on the left and right side ... What step did I miss?  ???

Thank you in advance!
Title: Re: Click-to-move - 2D - Top down
Post by: necrio2 on May 14, 2018, 07:54:56 PM
Mousepick is your friend here.
First, make a layer called ground/floor/whatever you want to click on.

Mouse pick 2d
Store point -- Mouse click
Layer mask 1 - Add the ground layer.

Move towards

Source is the mouse click


---

This is a simple solution. Have to perfect it a bit. Becuase I dont work in 2D, so I am basing this knowledge of 3D stuff.