Propel player at angle based on bullet firing

0 favourites
  • 3 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I've got a circular character with a cannon attached. The player can "roll" this character back and forth, changing the orientation of the cannon.

    When the cannon is overlapping the ground and the player shoots, I simulate a "jump" command on the platform behavior, making it seem like the player is being propelled upward by the cannon blast. The only problem with this is that it's always a straight up jump, regardless of what angle the cannon is pointing in.

    What would be the best way to make this jump angled based on the cannon position? I assume I'd need to manipulate some combination of vector x/y, but I don't know how to calculate that in real time based on the angle of the player (who has the cannon pinned to it).

  • Jump will only go up. You'll need to either apply a bullet behavior at angle, or physics impulse depending on how you have your physics set up.

    To get the angle from your cannon to your character, use the expression angle(cannon.x,cannon.y,character.x,character.y).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Should it, a question, not propell away from the turret ?

    Jumping towards the turret:

    https://www.dropbox.com/s/9ho9dfs9q5djv ... .capx?dl=0

    Ofcourse you have to keep the player from jumping when hit, means non default keys, i did not do all that in this example.

    Still think it is jumping away from the turret. But thats kinda the same example.

    Fine ?

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