playMaker

Author Topic: Click-to-move - 2D - Top down  (Read 1292 times)

Izzi

  • Playmaker Newbie
  • *
  • Posts: 1
Click-to-move - 2D - Top down
« 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:


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!
« Last Edit: May 14, 2018, 03:39:18 PM by Izzi »

necrio2

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Click-to-move - 2D - Top down
« Reply #1 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.