playMaker

Author Topic: Shooting in the direction of the Player  (Read 4807 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Shooting in the direction of the Player
« on: April 26, 2014, 08:30:17 PM »
Hi!
Maybe I have asked about this before.

Now I have a left and right movement. If I press the Space key, I will shoot a bullet in the direction of the player. I use Add Force to the bullet. I set 1000 to the X-axis, then it will shoot to the right. But when I'm walking to the left, it still shooting to the right. I know why. Because I set 1000 to the x-axis. If I set -1000, it will shoot to the left. How can I solve this, so it will shoot in the direction of the player?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: Shooting in the direction of the Player
« Reply #1 on: April 27, 2014, 12:22:57 PM »
Not sure if this is what you're looking for, but this tutorial was a huge help to me for figuring out how to shoot in the direction my player is looking:


4arrancho

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Shooting in the direction of the Player
« Reply #2 on: July 22, 2014, 09:00:39 PM »
Hi

Any news? Did you solve it? I have a problem like this for 2D

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Shooting in the direction of the Player
« Reply #3 on: July 23, 2014, 06:42:01 AM »
Hi!

MarkD:
It was not exactly what I was looking for, but I got some other tip there. :)
I was more looking for 2D side scrolling.

4arrancho:
I found a way which works, but I don't know if this is the best way to do it. Probably not.

First I set up to FSM. Shooting Left side and Shooting Right side.
Then I create a new FSM where I use a raycast which is checking the direction. I place a cube on each side of the level. So when I walk to the right and the raycast hits the cube on right side, I disable the FSM "Shooting Left side" and enable the FSM "Shooting Right side" and the same when I walk to the left.

This is just one of very many ways to do it. If this is a good or bad way to do it, it depends. But as long as it works. :)

I think Jean Fabre should make some 2D samples or something where 2D shooting will be a part of that.

Or else I would be very happy and grateful if somebody could make other and maybe better examples. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Shooting in the direction of the Player
« Reply #4 on: July 30, 2014, 05:52:26 AM »
Hi,

 It's actually there waiting for the next release of PlayMaker to become available to you :)

 I ported the Unity 2d platform sample to PlayMaker, so be prepare for 2d physics, shooting int he direction of the player, mecanim control for animation, etc etc.

Bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Shooting in the direction of the Player
« Reply #5 on: July 30, 2014, 06:07:35 AM »
Cool!
I look forward for this. :-)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Shooting in the direction of the Player
« Reply #6 on: July 30, 2014, 06:09:33 AM »
Do you know when the next release of Playmaker will be?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Shooting in the direction of the Player
« Reply #7 on: July 30, 2014, 06:11:09 AM »
Hi,

 No ETA on this currently, but it's under active dev at the moment, and I would not rush Alex on this, it's important that this release is rock solid, as many many changes and improvments where made under the hood.

 Bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Shooting in the direction of the Player
« Reply #8 on: July 30, 2014, 06:56:42 AM »
I'm agreed. It's better to use more time and make it good. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no