So, hello everybody, I am currently trying to implement the tutorial budy for my game. The game is a classical platformer but to understand the things better I've attached the screenshot.
So the problem is that I want the dummy to swing like a pendulum if somebody pushes it. I tried using the cos and sin functions for the image_angle controlled by the main function of simple harmonic motion or how is it called in English(yeah, by the way I am sorry if I missuse any physical terms, I am studying physics in other language).
So as a few lines it looks like this:
Where the oscillation progress is an analogue of time. But it's all good if I want to show 1-time effect controlled by some variables which are preset manually.
But in the game I want to create the truly working physics so when you push the dummy the angular frequency and other parameters are changed depending on the power of push, the current speed of oscillations and the direction of the push force( just left-right, don't have to mess with accurate angles, just 1 or -1 for the direction value)
So, I can tell a lot about how I was trying to do this, but anyway the result is surely not perfect and even not working. So, anyone familiar with such things who can help me???
So the problem is that I want the dummy to swing like a pendulum if somebody pushes it. I tried using the cos and sin functions for the image_angle controlled by the main function of simple harmonic motion or how is it called in English(yeah, by the way I am sorry if I missuse any physical terms, I am studying physics in other language).
So as a few lines it looks like this:
GML:
oscillation_progress++;
var _phase_shift = angular_frequency * oscillation_progress + starting_shift;
image_angle = oscillation_amplitude * sin(_phase_shift);
But in the game I want to create the truly working physics so when you push the dummy the angular frequency and other parameters are changed depending on the power of push, the current speed of oscillations and the direction of the push force( just left-right, don't have to mess with accurate angles, just 1 or -1 for the direction value)
So, I can tell a lot about how I was trying to do this, but anyway the result is surely not perfect and even not working. So, anyone familiar with such things who can help me???
Attachments
-
208.6 KB Views: 15
-
207.7 KB Views: 14