playMaker

Author Topic: Need Help With Projectiles in 2d Top Down  (Read 2068 times)

TinyDevil

  • Playmaker Newbie
  • *
  • Posts: 2
Need Help With Projectiles in 2d Top Down
« on: August 29, 2017, 12:59:51 PM »
Hello guys,

I'm new to playmaker and unity and im trying to make a 2d game similar to Hotline Miami.

I've done the movement (WASD) and my character already follows the mouse position.

However, I can't make projectiles to work properly. Several tutorials at youtube and this forum make it work but in a 3d environment, while I can't reproduce it in a 2d one.

I've made the projectile (an arrow) spawn at the front of my character wherever his looking at, but I can't make the arrow to move to its forward direction.

I've tried using a bunch of different actions and got several odd behaviors and the problem seems to be that i cant really separate the direction from the velocity of the bullet.

Can anyone give me a help making the arrow move to the direction where the mouse is at a defined speed ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Need Help With Projectiles in 2d Top Down
« Reply #1 on: August 29, 2017, 11:28:24 PM »
Hi,
On the Ecosystem you can get a "get Mouse position" action
then use a "screen to world point"
and use a "move towards


TinyDevil

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Need Help With Projectiles in 2d Top Down
« Reply #2 on: August 30, 2017, 11:44:20 AM »
Hi djaydino,

Thank you for taking your time to help me.

I tested out your suggestion and i still got some odd behavior. Maybe i didn't expressed my self correctly.

By following your instructions I was able to make the arrow follow exactly the mouse position, which is awesome, but i still have these concerns:

- The arrow stops at mouse position instead of keep going until i eventually destroy it.

- The speed of the arrow still depends if the mouse is close or far from the spawn point. What im trying to do is a constant speed no matter the mouse was close or far from the arrow when clicked.

- If i shoot one arrow and click again to shoot another one, the first arrow change its direction, now going to the same direction of the second one.

I'm playing with the actions and exploring ecosystem (which i didn't knew at all) to see if i find any solutions, but im having a hard time. I really appreciate your help.

Thank you in advance.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Need Help With Projectiles in 2d Top Down
« Reply #3 on: August 31, 2017, 02:13:10 AM »
ah ok,
Maybe you can look into this :

https://www.assetstore.unity3d.com/en/#!/content/7761