Advertisement
ywkls

Item Spawner

Aug 23rd, 2019
1,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //Section 44. Item Spawner
  2. //---COMMMENTING NEEDED--
  3.  
  4. ffc script Item_Spawner{
  5. void run(int item_to_spawn, int perm){
  6. bool acquired = false;
  7. item anitem;
  8. if(perm>0){
  9. if(Screen->D[perm]!=0)
  10. acquired = true;
  11. if(acquired){
  12. this->Data = 0;
  13. Quit();
  14. }
  15. anitem = Screen->CreateItem(item_to_spawn);
  16. anitem->X = this->X;
  17. anitem->Y = this->Y;
  18. while(!acquired){
  19. if(LinkCollision(anitem)){
  20. anitem->X = Link->X;
  21. anitem->Y = Link->Y;
  22. Game->PlaySound(SFX_PICKUP);
  23. Screen->D[perm]=1;
  24. acquired = true;
  25. }
  26. Waitframe();
  27. }
  28. }
  29. else{
  30. if(GetGameRestoreStation()==128){
  31. anitem = Screen->CreateItem(item_to_spawn);
  32. anitem->X = this->X;
  33. anitem->Y = this->Y;
  34. while(!acquired){
  35. if(LinkCollision(anitem)){
  36. anitem->X = Link->X;
  37. anitem->Y = Link->Y;
  38. Game->PlaySound(SFX_PICKUP);
  39. acquired = true;
  40. }
  41. Waitframe();
  42. }
  43. }
  44. }
  45. this->Data = 0;
  46. Quit();
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement