0 Favourites

Weapon aiming angles (2d platformer)

  • First of all, let me thank the devs and supporters of C2 for a brilliant product and awesome resources in the forums. I'm completely new at the coding part and I'm slowly trying to learn the ropes.

    Here's what I'm trying to achieve in my 2d platformer:

    1: Pin weapon sprite to player and have its mouse aim angle limited to between 300? and 60?, facing the direction of the player (left/right). Whenever outside the angles it should simply not turn further.

    2: Have player and weapon turn whenever the mouse is opposite current facing direction (eg. left/right).

    imgur.com/PEqR4RI

    I sort of understand different ways to approach this, but the solutions I come up with seem bloated and hacky, with the gun acting all wonky. I was hoping that I could get some samples or assistance to look at.

    Thanks!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hello there, you may want to look at posting a link to a sample caps file with an example of your current solution to give is a starting point.

    Another thought is to give the turret animation frames that handle the range of rotation. Set the origin point for the bullet at the top of the turret in each frame. That way to rotate you just cycle through the animation frames and the limits and angles are already taken care of. Just a thought.

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