Author Topic: [SOLVED] 2D Sidescroller Shooting  (Read 3131 times)


  • Playmaker Newbie
  • *
  • Posts: 4
[SOLVED] 2D Sidescroller Shooting
« on: April 08, 2015, 12:31:29 AM »
I applied the lessons in this video ( to make a simple shoot mechanic. Now here is where I need help expanding it:

This is a sidescroller in which the player is mean to shoot the way he is facing - either left or right. Similarly, he can also crouch, and shoot left or right. My problem is that the bullet travels right, regardless of the direction the player is facing.

How can I change the orientation of the bullet?
« Last Edit: April 11, 2015, 03:53:50 PM by SeamusLight »


  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: 2D Sidescroller Shooting
« Reply #1 on: April 09, 2015, 09:52:42 AM »
If you use the itween action to move the bullet like in that video its going to be hard to do-

Try making your bullet a rigid body and use "add force" to move it on the Z axis- as long as the gun or whatever is shooting/spawning/creating the bullets is pointing in the right direction it will work the way you want it to-

Also take note of world/self "Space" on the add force if it doesn't work right- try switching them
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!


  • Playmaker Newbie
  • *
  • Posts: 4
Re: 2D Sidescroller Shooting
« Reply #2 on: April 09, 2015, 12:56:24 PM »
I tried the Add Force action (moving it along the X-axis in this case) and the result is the same. When facing left, the bullet spawns on an empty object (as intended), but immediately shoots right, passing through the player sprite.

Here is a picture.
Any other suggestions?


  • Full Member
  • ***
  • Posts: 219
Re: 2D Sidescroller Shooting
« Reply #3 on: April 11, 2015, 11:16:24 AM »
looks like X is positive.  This means the bullet always moves right.  If you want it to move left, then X needs to be negative number.

You should create a float variable called "Bullet direction" that will be your bullet direction.  When you press "Left" in addition to moving the player left you should make set "Bullet Direction" to -1000 (in your example).  When you press right, set "Bullet Direction" to 1000.  This way it goes the correct direction.

If your player movement FSM is different than your gun FSM then use Playmaker Action "Set FSM Float" to modify it.

Alternatively, a simpler solution is to just spawn a prefab bullet that already has X=-1000 when left and X=1000 when facing right.
« Last Edit: April 11, 2015, 12:03:29 PM by PlaymakerNOOB »


  • Playmaker Newbie
  • *
  • Posts: 4
Re: [SOLVED] 2D Sidescroller Shooting
« Reply #4 on: April 11, 2015, 04:01:01 PM »
Hey, I figured out what I needed to make this system work - a global Boolean variable.

On the "Flip Left/Right" states on my player sprite, I put Set Bool actions. Then on the spawned bullet prefab I placed a Bool Test, which then transitioned into the Left/Right Shooting states which contained iTween actions sending the bullet along either the positive or negative X-axis. 

Everyone who contributed advice helped in some way to reaching this conclusion, and I would just like to thank you all for your help.   :D