Advertisement
TheEmeraldMax

My Frisk Movement Code Plus: Overworld

Dec 16th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.33 KB | None | 0 0
  1. Up = 0
  2. Down = 1
  3. Left = 0
  4. Right = 0
  5. Moving = 1 -- IMPORTANT! If It Sets To 0. You Cannot Move!
  6.  
  7.  
  8. b = CreateSprite("Fake_Overworld/back")
  9. b.layer = "Top"
  10. b.x = 320
  11. b.y = 230
  12. bg = CreateSprite("Fake_Overworld/hotlands_1")
  13. bg.layer = "Top"
  14. bg.x = 320
  15. bg.y = 230
  16. savepoint = CreateSprite("Fake_Overworld/spr_savepoint_0")
  17. savepoint.layer = "Top"
  18. savepoint.x = 320
  19. savepoint.y = 230
  20. frisk = CreateSprite("Fake_Overworld/Frisk/f_0")
  21. frisk.layer = "Top"
  22. frisk.x = 300
  23. frisk.y = 200
  24.  
  25. Player.SetControlOverride(true)
  26.  
  27. savepoint.SetAnimation({"Fake_Overworld/spr_savepoint_0", "Fake_Overworld/spr_savepoint_1"}, 1/2)
  28.  
  29. function Update()
  30. if Input.Up > 1 and Moving == 1 then
  31. frisk.y = frisk.y + 2
  32. Up = Up + 1
  33. Down = 0
  34. Left = 0
  35. Right = 0
  36. end
  37. if Input.Down > 1 and Moving == 1 then
  38. frisk.y = frisk.y - 2
  39. Down = Down + 1
  40. Up = 0
  41. Left = 0
  42. Right = 0
  43. end
  44. if Input.Left > 1 and Moving == 1 then
  45. frisk.x = frisk.x - 2
  46. Left = Left + 1
  47. Up = 0
  48. Down = 0
  49. Right = 0
  50. end
  51. if Input.Right > 1 and Moving == 1 then
  52. frisk.x = frisk.x + 2
  53. Right = Right + 1
  54. Up = 0
  55. Down = 0
  56. Left = 0
  57. end
  58. if Down > 2 and Down < 8 then
  59. frisk.SetAnimation({"Fake_Overworld/Frisk/f_0"})
  60. elseif Down > 9 and Down < 17 then
  61. frisk.SetAnimation({"Fake_Overworld/Frisk/f_1"})
  62. elseif Down > 18 and Down < 26 then
  63. frisk.SetAnimation({"Fake_Overworld/Frisk/f_2"})
  64. elseif Down > 27 and Down < 35 then
  65. frisk.SetAnimation({"Fake_Overworld/Frisk/f_3"})
  66. elseif Down > 36 then
  67. Down = 1
  68. end
  69. if Up > 2 and Up < 8 then
  70. frisk.SetAnimation({"Fake_Overworld/Frisk/b_0"})
  71. elseif Up > 9 and Up < 17 then
  72. frisk.SetAnimation({"Fake_Overworld/Frisk/b_1"})
  73. elseif Up > 18 and Up < 26 then
  74. frisk.SetAnimation({"Fake_Overworld/Frisk/b_2"})
  75. elseif Up > 27 and Up < 35 then
  76. frisk.SetAnimation({"Fake_Overworld/Frisk/b_3"})
  77. elseif Up > 36 then
  78. Up = 1
  79. end
  80. if Left > 2 and Left < 8 then
  81. frisk.SetAnimation({"Fake_Overworld/Frisk/l_0"})
  82. elseif Left > 9 and Left < 17 then
  83. frisk.SetAnimation({"Fake_Overworld/Frisk/l_1"})
  84. elseif Left > 36 then
  85. Left = 1
  86. end
  87. if Right > 2 and Right < 8 then
  88. frisk.SetAnimation({"Fake_Overworld/Frisk/r_0"})
  89. elseif Right > 9 and Right < 17 then
  90. frisk.SetAnimation({"Fake_Overworld/Frisk/r_1"})
  91. elseif Right > 36 then
  92. Right = 1
  93. end
  94. if Right == 0 and Left == 0 and Down == 0 and Up == 0 then
  95. error("Oops! You Did Not Choose Your Direction!")
  96. end
  97. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement