Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Enemy(img,positionX,positionY,life,shotrate,bombrate){
- let obj= ObjEnemy_Create(OBJ_ENEMY);
- let GetX = ObjMove_GetX(obj);
- let GetY = ObjMove_GetY(obj);
- let frame = 0;
- ObjEnemy_Regist(obj);
- ObjEnemy_SetLife(obj,life);
- ObjEnemy_SetDamageRate(obj,shotrate,bombrate);
- ObjEnemy_SetIntersectionCircleToShot(obj,GetX,GetY,15);
- ObjEnemy_SetIntersectionCircleToPlayer(obj,GetX,GetY,15);
- ObjPrim_SetTexture(obj, GetCurrentScriptDirectory() ~ img); //adding a texture
- //ObjSprite2D_SetSourceRect(obj, 0, 0, 32, 32); //selecting the right texture
- ObjSprite2D_SetSourceRect(obj, 97.5, 0, 129.5, 33.5);
- ObjSprite2D_SetDestCenter(obj); //positioning the texture
- FairyMaintenance(obj);
- return obj;
- task FairyMaintenance(fairy) {
- while(!Obj_IsDeleted(fairy) && ObjEnemy_GetInfo(fairy, INFO_LIFE) > 0) { // tests if the fairy is still alive
- // ObjEnemy_SetIntersectionCircleToShot(fairy, ObjMove_GetX(fairy), ObjMove_GetY(fairy), 16); // if not, give it a radius to be hit by stuff
- yield; //... you know what this does, right?
- }
- frame++;
- if(frame==60){;
- CreateShotA1(GetX,GetY,2,90,402,10);
- frame = 0;
- }
- if(ObjEnemy_GetInfo(fairy, INFO_LIFE) <= 0 && !Obj_IsDeleted(fairy)) { //tests if the fairy is dead
- // Obj_Delete(fairy); //makes the fairy dead
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement