How do I attach swivelling sword arm to sprite

Just started using Construct 2? Post your questions here

Post » Sat Feb 06, 2016 6:51 pm

Hi, I'm new to both Construct2 and programming, and scratching my head on how to attach a sword arm sprite object to a body sprite object. The view is top down, the sword arm should pivot 90deg from 12 o'clock to 3 o'clock from the sprite's shoulder using the arrow keys. I've worked through the beginner tutorial from start to finish four complete times, but have no clue how to achieve what I want. I've defined origin points on the two objects, I've created a 'pin' behaviour on the sword arm, but that's as far as I get. There doesn't seem to be anything further you can do with the pin once you've created it - just rename it is all!! And then how to get it to pivot with the arrow keys - I know it must relate to the keyboard object, which I also created, but how to link left right keys with pivot? I'm sure it's really simple to do, and sorry for such basic questions.
B
5
Posts: 6
Reputation: 239

Post » Sun Feb 07, 2016 12:43 am

Use "Pin" behavior to attach one sprite to another.
So add Pin to the arm, the add event System - On start of layout -> arm - Pin to object Body
B
14
S
3
G
1
Posts: 95
Reputation: 1,015

Post » Sun Feb 07, 2016 6:05 am

Yeah, you use the event sheet. Be sure to specify "position only" as the pin type. Then give your arm object the "rotate" behavior and give events to rotate some positive speed when right is down and angle is greater than zero, else rotate negative when left is down and angle is less than 270, else rotate with speed zero.

And at all costs, avoid the walruses... :shock:
Eh, Steve!
B
115
S
54
G
13
Posts: 113
Reputation: 16,151

Post » Sun Feb 07, 2016 7:15 pm

Sussed it!! fantastic, very many thanks for your help :D
B
5
Posts: 6
Reputation: 239


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests