Spawning projectile in relative direction of player

MarvinHawkinsMarvinHawkins Member Posts: 4
edited November -1 in Working with GS (Mac)
Hello,

I apologize if this has been answered elsewhere: But I am trying to create a mega man style shooter/platformer. The bullet spawns properly if the player is facing left. However, if the player is facing right, the bullets still spawn from the left. They also travel in the left direction. My question:

How do I spawn bullets and ensure that they are moving in the direction that the player is facing?

Comments

  • MarvinHawkinsMarvinHawkins Member Posts: 4
    Just to clarify: I have watched all videos related to spawning objects/actors. No matter which behavior I try (Move, Change Velocity, or Accelerate) The 'bullet' actor always seems to spawn in the positive direction (right) So if the player is turned to the left the 'bullet' will continue to spawn and move in the right direction. What am I doing wrong?
  • MarvinHawkinsMarvinHawkins Member Posts: 4
    anyone? Even a link would be super helpful. Sorry to seem needy, but I'm new, and at a bit of a loss. Its a nice tool, but I'm just lost.
  • pjnolenpjnolen Member Posts: 152
    Create a copy of your bullet, and reverse direction it moves. And make a rule to spawn that one when player is facing that direction.
  • DrGlickertDrGlickert Member Posts: 1,135
    You'll want to spawn the bullet based on player rotation.

    I have a cannon in my game that fires in different directions. On the spawn behavior I have is set to spawn
    Direction: -self.rotation
    Position: X: 72 Y: 0
    Relative to Actor
    Relative to Actor

    My actor is about 140 wide, so 72 puts it just in front of the actor when it fires.

    Give that a try.
Sign In or Register to comment.