- Thu 22 Mar 2018, 12:53
Gentlemen, we have achieved the sweet taste of success!! Lol!
Thank you very much Jubeliuksen, it works like a charm! Beau-ti-ful!!!
I owe you a beer for this, man!
But i did had to implement some tiny changes to your code for making it work the way i always wanted.
1- The key factor here is indeed the max slope angle stuff. I don´t know why i changed that value to 0 in the first place (can´t remember why) but the solution is in there, for sure.
(Just curious: what the "max slope angle" really does in GD??)
2- Then, looking at your screenshot, we can see that you are giving an action of value =2 to variable Player_Ani (line 5) but no consequent condition is given to that same action. The falling animation is very important to me and to my game project because i use the condition "player is falling+collision" so the Player may "kill" the enemies. It is not important to have the falling animation on the moving platform but i must have that animation when Player is outside the moving platform.
Anyway, i think the falling effect of the player is also an important key factor because some falling animations makes a strange effect on the global player movement when the plat is moving up, and only up. So i changed that falling animation to idle when the player is going up (like you did).
3- After testing your code a bit i started thinking if i could manage to get a different approach, a different method to make all this work... And i found it, i think. With the max slope angle to 60 (or similar value), a new hidden object behind the moving plat (following the trajectory of the moving plat) and a new condition like this, "Player is in collision with new object/Player is falling". With this there's no need to use those conditions of X and Y position of Player with the moving plat! Im still testing all this but it looks great!
Check it out this "new code":
Now, as i said im still perfoming some more tests to all this. Then i will make this changes into the game levels i already have and see how things go from there, but should not be any problem with that, for sure.
And im pretty sure we can still do all this in a different way, for example, making a small object follow the plat movement and making a condition for that... Or using some kind of player hitbox (a box object around the player making the player touch the plat all the time) for this purpose. Still didn´t test these two options but it may work as well, i don´t know.
The Final Work here now with two moving plats (and the code i posted above), if you want to check it.
As you can see, that black stripe makes all the difference. When the Player is in collision with it and the plat is moving up, the animation works fine but when the Player is outside the stripe it doesn´t work very well.
Again, thank you very much for this, Jubeliuksen! I would never understand all this without your feedback and help.
Now it´s time for me to put a few moving plats into some of my game levels. YES!! I will let you know how things go soon.
The "Final Work" file:https://www.dropbox.com/s/c8ap83w68cc19gs/Move_Plat_New.rar?dl=0