Guest User

Untitled

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