Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- task CreateShotReflect(x,y,v,ang,graphic,delay) {
- let obj_id = Obj_Create(OBJ_SHOT); let border = 20; let counter = 0;
- Obj_SetPosition(obj_id, x, y);
- ObjShot_SetGraphic(obj_id, graphic);
- Obj_SetSpeed(obj_id, v); Obj_SetAngle(obj_id, ang); ObjShot_SetDelay(obj_id, delay);
- while(!Obj_BeDeleted(obj_id)) {
- if(counter <= 1) {
- if(Obj_GetX(obj_id) > GetClipMaxX+border) { Obj_SetX(obj_id, 2*(GetClipMaxX+border)-Obj_GetX(obj_id)); Obj_SetAngle(obj_id, 180-Obj_GetAngle(obj_id)); counter+=2; }
- else if(Obj_GetX(obj_id) < GetClipMinX-border) { Obj_SetX(obj_id, 2*(GetClipMinX-border)-Obj_GetX(obj_id)); Obj_SetAngle(obj_id, 180-Obj_GetAngle(obj_id)); counter+=2; }
- else if(Obj_GetY(obj_id) < GetClipMinY-border) { Obj_SetY(obj_id, 2*(GetClipMinY-border)-Obj_GetY(obj_id)); Obj_SetAngle(obj_id, -Obj_GetAngle(obj_id)); counter+=1; }
- //else if(Obj_GetY(obj_id) > GetClipMaxY+border) { Obj_SetY(obj_id, 2*(GetClipMaxY+border)-Obj_GetY(obj_id)); Obj_SetAngle(obj_id, -Obj_GetAngle(obj_id)); counter+=1; }
- }
- wait(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment