Weapon aiming angles (2d platformer)

Get help using Construct 2

Post » Wed Jan 23, 2013 1:44 pm

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).


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.

Posts: 3
Reputation: 456

Post » Wed Jan 23, 2013 3:08 pm

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.
Posts: 1,833
Reputation: 14,633

Return to How do I....?

Who is online

Users browsing this forum: Kyledfrank and 58 guests