How do I make a bullet always face the player but look like a set angle

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I am making a game that is sorta like a top down pikmin game.

    I want the 'pikmin' to move to the player but always be facing either left or right.

    Help?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can set angle of object = angle(bullet.X, bullet.Y, player.X, player.Y)

    A kind of homing bullet mechanic.

    Is this what you need?

  • You can set angle of object = angle(bullet.X, bullet.Y, player.X, player.Y)

    A kind of homing bullet mechanic.

    Is this what you need?

    Can you explain how to do this?

    I'm not sure if its what I want but it might be.

    I already have it so the 'pikmin' move towards the player but I cant get it so that they don't face the player. And I want that because the game isn't top down on the players head

    I guess I should have asked "How can I make a bullet move in one way. But face another"

  • First of all, your sprite should face right in the Sprite Editor.

    Then in the event sheet:

    *You can use Self.X for pikmin.X*

  • First of all, your sprite should face right in the Sprite Editor.

    Then in the event sheet:

    *You can use Self.X for pikmin.X*

    That's not what Miles_Miles is asking for. In fact, I think they made it clear that this is what they don't want.

    I already have it so the 'pikmin' move towards the player but I cant get it so that they don't face the player. And I want that because the game isn't top down on the players head

    Without seeing the sprite, I can't tell you what the appropriate approach would be, but I can offer some suggestions.

    1. Set the "pikmin" angle to: angle(Pikmin.X, Pikmin.Y, Player.X, Pikmin.Y). This should cause the "pikmin" to "face" the player via rotation, but only ever directly to the left or right.

    2. Use the "Set Flipped" action to flip the sprite. This is what most retro games do. Compare the X position of the "Pikmin" and the player to determine whether the sprite should be flipped or not.

    Whichever approach you use, you will need to adjust it if you ever decide that the "Pikmin" should move to somewhere other than the player, even if only as an intermediate step (like with pathfinding). If I were writing this, I would set up two instance variables on the "Pikmin" titled "GoalX" and "GoalY", and use them to store whatever position the "Pikmin" should be moving towards.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)