Mewkyuu

Untitled

Sep 17th, 2011
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. task CreateShotReflect(x,y,v,ang,graphic,delay) {
  2. let obj_id = Obj_Create(OBJ_SHOT); let border = 20; let counter = 0;
  3. Obj_SetPosition(obj_id, x, y);
  4. ObjShot_SetGraphic(obj_id, graphic);
  5. Obj_SetSpeed(obj_id, v); Obj_SetAngle(obj_id, ang); ObjShot_SetDelay(obj_id, delay);
  6. while(!Obj_BeDeleted(obj_id)) {
  7. if(counter <= 1) {
  8. 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; }
  9. 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; }
  10. 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; }
  11. //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; }
  12. }
  13. wait(1);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment