Ask here your questions to get help using GDevelop.
User avatar
By PastaPrimera
#65508 Hello everyone!

I would like to attach a pendulum to a WASD controlled object. However, when no key is pressed, the pendulum should not move. The pendulum should only move continuously back and forth when pressing the D or A key (forward, backward) and it should stop when those keys are not pressed anymore.

I would really much appreciate it if you could provide some assistance. :)
User avatar
By Lizard-13
#65509 Which behaviors are you using?, I need some context, maybe it's a platformer swinging on a rope?
Anyway, probably you'll have to deactivate some behaviors while swinging...
User avatar
By PastaPrimera
#65511 Thank you for the swift reply, Lizard-13!

Actually, I haven't used any behaviors. I tried using the All Objects>Angle>All rotate actions along with a variable that only determine if the swinging arm is past a certain angle (if angle >= 45, then var swinging_left = 1) or something like that. Then after that, it will swing in the opposite direction. Maybe a windshield wiper is a more suited example rather than a pendulum.

The gist is that I'm trying to make a walking character without pre-made sprites for animation. The reason being is that I want to attach weapons with particle effects to the hand or at the end of the arm. Kind of like a ragdoll/paper doll with programmed animations. I just couldn't figure out the windshield wiper motion while a key is pressed. I might also need to flip the whole thing when facing the opposite direction.

Image

P.S. I also tried using a collision object when the arm touches it along with a variable but it still doesn't work. Also, kindly disregard the WASD movement. Just a simple left right, platformer type movement with jumping.
User avatar
By PastaPrimera
#65522 HOLY CRAP!

You are a genius, Lizard-13! Thank you very much, too! All that's left to do is to study the events. Such a great help. :D

Thanks also for making the logic much easier to understand. I just have one question about the Up and Down movement of the Body. I saw somewhere about a built-in Sine movement from another engine (but I like GDevelop more). Where or how did you come up with this equation: "355 - cos(ToRad(LegR.Angle()))*30"?

Sorry, I'm not very good at Math. :(