Guest User

Untitled

a guest
Aug 21st, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1.  
  2. function CreateFairy(img,positionX,positionY,life,shotrate,bombrate){
  3. let obj= ObjEnemy_Create(OBJ_ENEMY);
  4. let GetX = ObjMove_GetX(obj);
  5. let GetY = ObjMove_GetY(obj);
  6. let frame = 0;
  7. ObjEnemy_Regist(obj);
  8. ObjEnemy_SetLife(obj,life);
  9. ObjEnemy_SetDamageRate(obj,shotrate,bombrate);
  10. ObjPrim_SetTexture(obj, GetCurrentScriptDirectory() ~ img); //adding a texture
  11. //ObjSprite2D_SetSourceRect(obj, 0, 0, 32, 32); //selecting the right texture
  12. ObjSprite2D_SetSourceRect(obj, 97.5, 0, 129.5, 33.5);
  13. ObjSprite2D_SetDestCenter(obj); //positioning the texture
  14. ObjMove_SetPosition(obj, positionX, positionY); //this was previously missing
  15. return obj;
  16. }
  17.  
  18. task FairyMaintenanceA1(fairy){
  19. while(!Obj_IsDeleted(fairy) && ObjEnemy_GetInfo(fairy, INFO_LIFE) > 0) {
  20. ObjEnemy_SetIntersectionCircleToShot(obj,ObjMove_GetX(fairy), ObjMove_GetY(fairy),12); //shot hitbox
  21. ObjEnemy_SetIntersectionCircleToPlayer(obj,ObjMove_GetX(fairy), ObjMove_GetY(fairy),8); //player hitbox
  22.  
  23. if(frame>=60){
  24. CreateShotA1(GetX,GetY,2,90,402,10);
  25. frame = 0;
  26. }
  27. frame++;
  28.  
  29. //that second if statement was redundant, the while loop already checks that
  30. yield;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment