Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. -- A basic encounter script skeleton you can copy and modify for your own creations.
  2.  
  3. music = "mus_battle1"
  4. encountertext = "Vegetoid came out of\rthe earth!"
  5. nextwaves = {"bullettest_chaserorb", "bullettest_boucy"}
  6. wavetimer = 4.0
  7. arenasize = {155, 130}
  8.  
  9. enemies = { "Vegetoid" }
  10.  
  11. enemypositions = {
  12. {0, 50},
  13. {-70, 30},
  14. {70, 30}
  15. }
  16.  
  17. -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here in case you want to use it.
  18. possible_attacks = {"bullettest_bouncy", "bullettest_chaserorb", "bullettest_touhou"}
  19.  
  20. function EncounterStarting()
  21.  
  22. end
  23.  
  24. function EnemyDialogueStarting()
  25.  
  26. end
  27.  
  28. function EnemyDialogueEnding()
  29. -- Good location to fill the 'nextwaves' table with the attacks you want to have simultaneously.
  30. -- This example line below takes a random attack from 'possible_attacks'.
  31. nextwaves = { possible_attacks[math.random(#possible_attacks)] }
  32. end
  33.  
  34. function DefenseEnding() --This built-in function fires after the defense round ends.
  35. encountertext = RandomEncounterText() --This built-in function gets a random encounter text from a random enemy.
  36. end
  37.  
  38. function HandleSpare()
  39. State("ENEMYDIALOGUE") --By default, pressing spare only spares the enemies but stays in the menu. Changing state happens here.
  40. end
  41.  
  42. function HandleItem(ItemID)
  43. BattleDialog({"Selected item " .. ItemID .. "."})
  44. end
  45.  
  46. if enemies[1].isSpared == true then
  47. SetSprite("Vegetoid4")
  48. else
  49. animationFrames = {"Vegetoid1", "Vegetoid2", "Vegetoid1", "Vegetoid4"}
  50. currentFrame = 1
  51. animationTimer = 0
  52.  
  53. function Update()
  54. animationTimer = animationTimer + 1
  55. if(animationTimer%20 == 0) then
  56. currentFrame = (currentFrame % (#animationFrames)) + 1
  57. animationTimer = 0
  58. enemies[1].SetSprite(animationFrames[currentFrame])
  59. end
  60. end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement