Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. // Section 6. Platform script. Created by Moosh
  2.  
  3. ffc script Moving_Platform{
  4. //This detects if Link is performing an action that should prevent him from moving while on a platform
  5. bool LinkBusy(){
  6. return !(Link->Action<LA_ATTACKING
  7. ||Link->Action==LA_CHARGING
  8. ||Link->Action==LA_GOTHURTLAND
  9. ||SamusVars[LINK_ACTION]<LA_ATTACKING);
  10. }
  11. //This detects if Link is using the hookshot, an item that bugs out horribly if Link is moved while using it
  12. void run(){
  13. bool Grounded = false;
  14. int PlatformCooldown;
  15. while(true){
  16. //This detects when Link gets on the platform
  17. if(OnPlatform(this,false,this->Script) && PlatformCooldown<=0){
  18. if (!Grounded){
  19. Grounded = true;
  20. SamusVars[ON_GROUND_OVERRIDE]=1;
  21. Link->Y = this->Y-16;
  22. }
  23. //This snaps Link to the platform when he isn't hookshotting
  24. if(PlatformCooldown<=0){
  25. if(Link->Jump<=0)
  26. Link->Jump = 0;
  27. }
  28. if(!(Link->PressLeft
  29. ||Link->InputLeft
  30. ||Link->InputRight
  31. ||Link->PressRight))
  32. Link->X = this->X+(((this->TileWidth-1)*16)/2);
  33. if(LinkBusy())NoAction();
  34. if(!SamusVars[IS_MORPHED]){
  35. if(PressJump()){
  36. Link->Y-=24;
  37. Grounded = false;
  38. Jump_Routine();
  39. PlatformCooldown= 30;
  40. }
  41. }
  42. else{
  43. if(PressFire()){
  44. if(SamusVars[EQUIPPED_ITEM]!=I_POWER_BOMB && Link->Item[I_BOMB]){
  45. Link->Y-=24;
  46. Grounded= false;
  47. PlatformCooldown= 30;
  48. }
  49. }
  50. if(Link->Item[I_SPRING_BALL] && PressJump()){
  51. Link->Y-=24;
  52. Grounded=false;
  53. Jump_Routine();
  54. PlatformCooldown= 30;
  55. }
  56. }
  57. while(Grounded){
  58. if(!SamusVars[IS_MORPHED]){
  59. if(PressJump()){
  60. Link->Y-=24;
  61. Grounded = false;
  62. Jump_Routine();
  63. PlatformCooldown= 30;
  64. }
  65. else{
  66. if(PlatformCooldown<=0)
  67. Link->Y = this->Y-16;
  68. }
  69. }
  70. else{
  71. if(PressFire() && Link->Item[I_BOMB] && SamusVars[EQUIPPED_ITEM]!=I_POWER_BOMB){
  72. Link->Y-=24;
  73. Grounded = false;
  74. PlatformCooldown= 30;
  75. }
  76. else if(Link->Item[I_SPRING_BALL] && PressJump()){
  77. Link->Y-=24;
  78. Grounded = false;
  79. Jump_Routine();
  80. PlatformCooldown= 30;
  81. }
  82. else{
  83. if(PlatformCooldown<=0)
  84. Link->Y = this->Y-16;
  85. }
  86. }
  87. if (!OnPlatform(this, false,this->Script)){
  88. Grounded = false;
  89. SamusVars[ON_GROUND_OVERRIDE]=0;
  90. }
  91. if(!(Link->PressLeft||Link->InputLeft
  92. ||Link->InputRight||Link->PressRight))
  93. Link->X = this->X+(((this->TileWidth-1)*16)/2);
  94. if(PlatformCooldown>0)
  95. PlatformCooldown--;
  96. Waitframe();
  97. }
  98. }
  99. else if (Grounded && !OnPlatform(this, false,this->Script)){
  100. Grounded = false;
  101. if (!OnPlatform(this, true,this->Script))
  102. SamusVars[ON_GROUND_OVERRIDE]=0;
  103. }
  104. if(PlatformCooldown>0)
  105. PlatformCooldown--;
  106. Waitframe();
  107. }
  108. Grounded = false;
  109. SamusVars[ON_GROUND_OVERRIDE]=0;
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement