Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. //Section 43. Inverse Jumper
  2. //---COMMMENTING NEEDED--
  3.  
  4. ffc script Sideview_Inverse_Jumper{
  5. void run (int enemyID){
  6. npc ghost = Ghost_InitAutoGhost(this, enemyID);
  7. Ghost_SetFlag(GHF_NO_FALL);
  8. float x = Ghost_X;
  9. float y = Ghost_Y;
  10. float vy;
  11. float vx = -1;
  12. int timer;
  13. int Width = Ghost_GetAttribute(ghost,0,1);
  14. int Height = Ghost_GetAttribute(ghost,1,1);
  15. Ghost_SetSize(this,ghost,Width,Height);
  16. while (true){
  17. if (Screen->isSolid(Ghost_X + 8, Ghost_Y - 1)){
  18. if (SamusVars[TIMER_JUMP] <= 0){
  19. vx = Sign(vx) * Choose(1, 1.5, 2);
  20. vy = 3;
  21. SamusVars[TIMER_JUMP] = Rand(30, 70);
  22. Game->PlaySound(SFX_JUMP);
  23. }
  24. else if (vy < 0)
  25. vy = 0;
  26. }
  27. y += vy;
  28. vy -= GRAVITY;
  29. if ((vy > 0 && !Screen->isSolid(Ghost_X + 8, Ghost_Y + 17))
  30. || (vy < 0 && !Screen->isSolid(Ghost_X + 8, Ghost_Y - 1)))
  31. Ghost_Y = Round(y);
  32. if (SamusVars[TIMER_JUMP] > 0 && Screen->isSolid(Ghost_X + 8, Ghost_Y - 1))
  33. SamusVars[TIMER_JUMP]--;
  34. if (vx >= 0 && !Screen->isSolid(Ghost_X + 8, Ghost_Y - 1)){
  35. if (!Screen->isSolid(Ghost_X + 17, Ghost_Y + 8)){
  36. x += vx;
  37. Ghost_X = Round(x);
  38. }
  39. else
  40. vx = -1 * Abs(vx);
  41. }
  42. if (vx < 0 && !Screen->isSolid(Ghost_X + 8, Ghost_Y - 1)){
  43. if (!Screen->isSolid(Ghost_X - 1, Ghost_Y + 8)){
  44. x += vx;
  45. Ghost_X = Round(x);
  46. }
  47. else
  48. vx = Abs(vx);
  49. }
  50. Ghost_Waitframe(this, ghost);
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement