bullet behavior help (space game)

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • the bullet keeps going wrong way i need it to shoot in front of the player sprite it shoots wrong way


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's because your ship is flying backwards! Just kidding. I did it like this (surely there are other ways though): Set bullet's angle "Set angle" parameter to Yes, add a global variable (ShootAngle, for example) which'll determine bullet's shooting angle, change it accordingly when player's moving direction changes. And finally, set the bullet's angle to ShootAngle after the bullet is created.

    That ship really is flying backwards, though.

  • i have tried that and didnt work i dont know what else to do any other ideas ?

  • You have separate animations for up, down, right, left.

    Create a global variable called PlayerShipDir.

    Create a series of conditions:

    PlayerShip is playing Up, then set PlayerShipDir to "Up"

    PlayerShip is playing Down, then set PlayerShipDir to "Down"

    PlayerShip is playing Left, then set PlayerShipDir to "Left"

    PlayerShip is playing Right, then set PlayerShipDir to "Right"

    Then make a sub-event below when space is pressed.

    PlayerShipDir = "Up" then set bullet angle of motion to 270

    PlayerShipDir = "Down" then set bullet angle of motion to 90

    PlayerShipDir = "Left" then set bullet angle of motion to 180

    PlayerShipDir = "Right" then set bullet angle of motion to 0

    And you should probably fix the problem of the ship flying backward.

  • I played around with your Capx, fixing a few glitches. I think I fixed to a playable state, but don't save it over your other one, in case I did something you don't like.


    There are Comments with things I did.

    Edit: If you'd rather I didn't leave your game source up, let me know and I'll delete it.

    In case someone is also looking for similar answers, mainly what I did was change all ships to face right in the Animation editor, because all behaviors expect the front to be to the right, if your sprite isn't it will look funny. (Except the boss ship, which just slides side to side.)

    I set the boss bullets to aim at the location of the player, so don't sit still. (I didn't beat him after that.)

    I also fixed image points, for example the star animation had a bounce in it due to a misaligned origin point.

    And I set it to rotate one ship sprite so it's direction could tell the bullet where to go. (rather than using sprites facing each direction.)

    The different animations can still be used, as long as they all face right.

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