521 DeleteMe; |
521 DeleteMe; |
522 exit |
522 exit |
523 end; |
523 end; |
524 Gear.dX:= HHGear.X - Gear.X; |
524 Gear.dX:= HHGear.X - Gear.X; |
525 Gear.dY:= HHGear.Y - Gear.Y; |
525 Gear.dY:= HHGear.Y - Gear.Y; |
|
526 AddFileLog('Rope 1: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); |
|
527 AddFileLog('Rope 2: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); |
526 |
528 |
527 if (Gear.Message and gm_Left <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else |
529 if (Gear.Message and gm_Left <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else |
528 if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002; |
530 if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002; |
529 |
531 |
530 if not TestCollisionYwithGear(HHGear, 1) then HHGear.dY:= HHGear.dY + cGravity; |
532 if not TestCollisionYwithGear(HHGear, 1) then |
|
533 begin |
|
534 HHGear.dY:= HHGear.dY + cGravity; |
|
535 AddFileLog('Rope 4: free fall'); |
|
536 end; |
|
537 |
|
538 AddFileLog('Rope 3: ' + floattostr(HHGear.dY)); |
531 |
539 |
532 cs:= Gear.dY + HHGear.dY; |
540 cs:= Gear.dY + HHGear.dY; |
533 cc:= Gear.dX + HHGear.dX; |
541 cc:= Gear.dX + HHGear.dX; |
534 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
542 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
535 cc:= cc * len; |
543 cc:= cc * len; |
536 cs:= cs * len; |
544 cs:= cs * len; |
|
545 |
|
546 AddFileLog('Rope 5: (' + floattostr(cc) + ',' + floattostr(cs) + ')'); |
537 |
547 |
538 flCheck:= not flCheck; |
548 flCheck:= not flCheck; |
539 if flCheck then // check whether rope needs dividing |
549 if flCheck then // check whether rope needs dividing |
540 begin |
550 begin |
541 len:= Gear.Elasticity - 20; |
551 len:= Gear.Elasticity - 20; |
580 end; |
590 end; |
581 |
591 |
582 Gear.dX:= HHGear.X - Gear.X; |
592 Gear.dX:= HHGear.X - Gear.X; |
583 Gear.dY:= HHGear.Y - Gear.Y; |
593 Gear.dY:= HHGear.Y - Gear.Y; |
584 |
594 |
|
595 AddFileLog('Rope 6: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); |
|
596 |
585 cs:= Gear.dY + HHGear.dY; |
597 cs:= Gear.dY + HHGear.dY; |
586 cc:= Gear.dX + HHGear.dX; |
598 cc:= Gear.dX + HHGear.dX; |
587 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
599 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
588 cc:= cc * len; |
600 cc:= cc * len; |
589 cs:= cs * len; |
601 cs:= cs * len; |
603 HHGear.Y:= Gear.Y + cs*Gear.Elasticity; |
615 HHGear.Y:= Gear.Y + cs*Gear.Elasticity; |
604 |
616 |
605 HHGear.dX:= HHGear.X - HHGear.dX; |
617 HHGear.dX:= HHGear.X - HHGear.dX; |
606 HHGear.dY:= HHGear.Y - HHGear.dY; |
618 HHGear.dY:= HHGear.Y - HHGear.dY; |
607 |
619 |
|
620 AddFileLog('Rope 7: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); |
|
621 AddFileLog('Rope 8: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); |
|
622 |
608 if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then |
623 if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then |
609 HHGear.dX:= -0.6 * HHGear.dX; |
624 HHGear.dX:= -0.6 * HHGear.dX; |
610 if TestCollisionYwithGear(HHGear, hwSign(HHGear.dY)) then |
625 if TestCollisionYwithGear(HHGear, hwSign(HHGear.dY)) then |
611 HHGear.dY:= -0.6 * HHGear.dY; |
626 HHGear.dY:= -0.6 * HHGear.dY; |
|
627 |
|
628 AddFileLog('Rope 9: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); |
612 |
629 |
613 if (Gear.Message and gm_Attack) <> 0 then |
630 if (Gear.Message and gm_Attack) <> 0 then |
614 if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else |
631 if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else |
615 else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
632 else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
616 end; |
633 end; |