Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - VBA

Страница: 1 | 2 |

 

  Вопрос: --> Вопрос по поводу движения объектов <-- Добавлено: 03.06.08 18:52  

Автор вопроса:  Jason`

Ответить

  Ответы Всего ответов: 17  

Номер ответа: 16
Автор ответа:
 AgentFire



ICQ: 192496851 

Вопросов: 75
Ответов: 3178
 Профиль | | #16 Добавлено: 04.06.08 12:02
А я 3 года назад :-p

Public Sub MoveShips()
Dim i As Long, d2 As Double, Px As Double, Py As Double, j As Long
Dim VPx1 As Double, VPy1 As Double, VNx1 As Double, VNy1 As Double
Dim VPx2 As Double, VPy2 As Double, VNx2 As Double, VNy2 As Double
Dim t As Long, Hitten As Boolean, RandomAngle As Double, Random As Double
Dim u As Long, X As Double, Y As Double
t = Rnd * 99 + 1
For i = 1 To MaxPlayers
    With Player(i)
        If .FramesToRespawn = 0 And .Exist Then
            .X = .X + .FX
            .Y = .Y + .FY
            If .PushedBy > 0 Then .PushedByTime = .PushedByTime - 1
            If .PushedByTime = 0 Then .PushedBy = 0
            If Sqr(.FY ^ 2 + .FX ^ 2) > .Speed Then
                .FX = Cos(AngleFromTwoPoints(.X, .Y, .X + .FX, .Y + .FY) / 180 * Pi) * .Speed
                .FY = Sin(AngleFromTwoPoints(.X, .Y, .X + .FX, .Y + .FY) / 180 * Pi) * .Speed
            Else
                'If Abs(.LastFX - .FX) <= 0.001 Then .FX = .FX * 0.8
                'If Abs(.LastFY - .FY) <= 0.001 Then .FY = .FY * 0.8
            End If
            .LastFX = .FX
            .LastFY = .FY
            If Abs(.FX) <= 0.075 Then .FX = 0
            If Abs(.FY) <= 0.075 Then .FY = 0
            If .HP > 0 Then
            For j = 1 To Map.TrapCount
                If Sqr((.X - Map.Trap(j).X) ^ 2 + (.Y - Map.Trap(j).Y) ^ 2) <= 30 + 24 Then
                    t = Rnd * 99 + 1
                    If t <= 5 Then
                        Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                        Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                    Else
                        .HP = .HP - 50
                        Call CreateFallingText("-50", i, .X, .Y, 0, -1)
                        Call PlaySound(dsHit(4), DSBPLAY_DEFAULT)
                    End If
                      '&#209;&#247;&#224;&#241; &#236;&#251; &#234;&#224;&#234; &#247;&#242;&#238;-&#237;&#232;&#225;&#243;&#228;&#252; &#240;&#224;&#241;&#241;&#247;&#232;&#242;&#224;&#229;&#236;!
                      Px = .X - Map.Trap(j).X '&#238;&#242;&#237;&#238;&#241;&#232;&#242;&#229;&#235;&#252;&#237;&#238;&#229; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#229; &#239;&#238; X
                      Py = .Y - Map.Trap(j).Y '&#238;&#242;&#237;&#238;&#241;&#232;&#242;&#229;&#235;&#252;&#237;&#238;&#229; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#229; &#239;&#238; Y
                      d2 = Px * Px + Py * Py '&#234;&#226;&#224;&#228;&#240;&#224;&#242; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#255;
          'TRAPS
                      If d2 > 0 Then
                          VPx1 = (Px * .FX + Py * .FY) * Px / d2 '\_&#239;&#229;&#240;&#239;&#229;&#237;&#228;&#232;&#234;&#243;&#235;&#255;&#240; i
                          VPy1 = (Px * .FX + Py * .FY) * Py / d2 '/
                          VNx1 = (Py * .FX - Px * .FY) * Py / d2 '\_&#237;&#238;&#240;&#236;&#224;&#235;&#252; i
                          VNy1 = (Px * .FY - Py * .FX) * Px / d2 '/
                          VPx2 = -VPx1
                          VPy2 = -VPy1
                          VNx2 = -VNx1
                          VNy2 = -VNy1
                          If Px * (VPx2 - VPx1) + Py * (VPy2 - VPy1) > 0 Then '&#247;&#242;&#238;&#225;&#251; &#237;&#229; &#241;&#235;&#232;&#239;&#224;&#235;&#232;&#241;&#252;
                              .FX = ((24 ^ (1 / 3) - 30 ^ (1 / 3)) * .FX + 2 * 30 ^ (1 / 3) * (VPx2 + VNx1)) / (24 ^ (1 / 3) + 30 ^ (1 / 3))
                              .FY = ((24 ^ (1 / 3) - 30 ^ (1 / 3)) * .FY + 2 * 30 ^ (1 / 3) * (VPy2 + VNy1)) / (24 ^ (1 / 3) + 30 ^ (1 / 3))
                              
                              .FX = .FX - 2 * Cos(AngleFromTwoPoints(.X, .Y, Map.Trap(j).X, Map.Trap(j).Y) * Pi / 180)
                              .FY = .FY - 2 * Sin(AngleFromTwoPoints(.X, .Y, Map.Trap(j).X, Map.Trap(j).Y) * Pi / 180)
                              .X = .X + .FX
                              .Y = .Y + .FY
                          End If
                          If (.PushedBy = 0 And .PushedBy <> i) Then .PushedBy = i
                          .PushedByTime = PushedByTime
                          For t = 1 To 50
                                  RandomAngle = Rnd * 360
                                  Random = Rnd * 5
                                  Call CreateShootStar(i, _
                                      .X + 24 * Cos(AngleFromTwoPoints(.X, .Y, Map.Trap(j).X, Map.Trap(j).Y)), _
                                      .Y + 24 * Sin(AngleFromTwoPoints(.X, .Y, Map.Trap(j).X, Map.Trap(j).Y)), _
                                      ;(9 + Random) * Cos(RandomAngle * Pi / 180), _
                                      ;(5 + Random) * Sin(RandomAngle * Pi / 180))
                              ';/
                          Next 'stars
                      End If
                  End If 'distance
              Next 'END TRAP CHECK
              
              If .X < 10 + 22 Then
                  If t <= 5 Then
                      Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                      Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                  Else
                      .HP = .HP - Abs(.FX)
                      Call CreateFallingText("-" & CLng(Abs(.FX)), i, .X, .Y, 0, -1)
                      Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                  End If
                  .X = 10 + 22
                  .FX = Abs(.FX) * 0.6 + 1
                  .FY = .FY * µ '0.85
                  For j = 1 To Abs(.FX) * 4
                      RandomAngle = Rnd * 180 - 90
                      Random = Rnd * 4 + 2
                      Call CreateShootStar(i, .X - 22, .Y, (Abs(.FX) + Random) * Cos(RandomAngle * Pi / 180), Abs(.FX / 2 + Random) * Sin(RandomAngle * Pi / 180))
                  Next
                  Hitten = True
              End If
    'BORDERS
              If .X > Map.Width - 10 - 22 Then
                  If t <= 5 Then
                      Call CreateFallingText("JUST", i, .X - 32, .Y, 0, -1)
                      Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                  Else
                      .HP = .HP - Abs(.FX)
                      Call CreateFallingText("-" & CLng(Abs(.FX)), i, .X - 32, .Y, 0, -1)
                      Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                  End If
                  .X = Map.Width - 10 - 22
                  .FX = -Abs(.FX) * 0.6 - 1
                  .FY = .FY * µ '0.85
                  For j = 1 To Abs(.FX) * 4
                      RandomAngle = Rnd * 180 + 90
                      Random = Rnd * 4 + 2
                      Call CreateShootStar(i, .X + 22, .Y, (Abs(.FX) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FX) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                  Next
                  Hitten = True
              End If
              If .Y < 10 + 13 Then
                  If t <= 5 Then
                      Call CreateFallingText("JUST", i, .X, .Y, 0, 0.5)
                      Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                  Else
                      .HP = .HP - Abs(.FY)
                      Call CreateFallingText("-" & CLng(Abs(.FY)), i, .X, .Y, 0, 0.5)
                      Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                  End If
                  .Y = 10 + 13
                  .FY = Abs(.FY) * 0.6 + 1
                  .FX = .FX * µ '0.85
                  For j = 1 To Abs(.FY) * 4
                      RandomAngle = Rnd * 180
                      Random = Rnd * 4 + 2
                      Call CreateShootStar(i, .X, .Y - 13, (Abs(.FY) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FY) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                  Next
                  Hitten = True
              End If
              If .Y > Map.Height - 10 - 15 Then
                  If t <= 5 Then
                      Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                      Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                  Else
                      .HP = .HP - Abs(.FY)
                      Call CreateFallingText("-" & CLng(Abs(.FY)), i, .X, .Y, 0, -1)
                      Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                  End If
                  .Y = Map.Height - 10 - 15
                  .FY = -Abs(.FY) * 0.6 - 1
                  .FX = .FX * µ '0.85
                  For j = 1 To Abs(.FY) * 4
                      RandomAngle = Rnd * 180 + 180
                      Random = Rnd * 4 + 2
                      Call CreateShootStar(i, .X, .Y + 15, (Abs(.FY) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FY) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                  Next
                  Hitten = True
              End If
          End If
          
          '============ *** &#210;&#211;&#210; &#207;&#208;&#206;&#194;&#197;&#208;&#223;&#197;&#204; &#209;&#210;&#206;&#203;&#202;&#205;&#206;&#194;&#197;&#205;&#200;&#197; &#209; &#206;&#193;&#218;&#197;&#202;&#210;&#192;&#204;&#200; *** ============
          For j = 1 To Map.WallsCount
              If .X > Map.Walls(j).X And .X < Map.Walls(j).X + Map.Walls(j).Width Then
                  If .Y + 15 > Map.Walls(j).Y And .Y <= Map.Walls(j).Y + Map.Walls(j).Height / 2 Then
                      If t <= 5 Then
                          Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                      Else
                          .HP = .HP - Abs(.FY)
                          Call CreateFallingText("-" & CLng(Abs(.FY)), i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                      End If
                      .Y = Map.Walls(j).Y - 15
                      .FY = -Abs(.FY) * 0.6 - 1
                      .FX = .FX * µ '0.85
                      For t = 1 To Abs(.FY) * 4
                          RandomAngle = Rnd * 180 + 180
                          Random = Rnd * 4 + 2
                          Call CreateShootStar(i, .X, .Y + 15, (Abs(.FY) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FY) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                      Next
                      Hitten = True
                  ElseIf .Y - 15 < Map.Walls(j).Y + Map.Walls(j).Height And .Y > Map.Walls(j).Y + Map.Walls(j).Height / 2 Then
                      If t <= 5 Then
                          Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                      Else
                          .HP = .HP - Abs(.FY)
                          Call CreateFallingText("-" & CLng(Abs(.FY)), i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                      End If
                      .Y = Map.Walls(j).Y + Map.Walls(j).Height + 15
                      .FY = Abs(.FY) * 0.6 + 1
                      .FX = .FX * µ '0.85
                      For t = 1 To Abs(.FY) * 4
                          RandomAngle = Rnd * 180
                          Random = Rnd * 4 + 2
                          Call CreateShootStar(i, .X, .Y - 15, (Abs(.FY) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FY) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                      Next
                      Hitten = True
                  End If
              ElseIf .Y > Map.Walls(j).Y And .Y < Map.Walls(j).Y + Map.Walls(j).Height Then
                  If .X + 22 > Map.Walls(j).X And .X <= Map.Walls(j).X + Map.Walls(j).Width / 2 Then
                      If t <= 5 Then
                          Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                      Else
                          .HP = .HP - Abs(.FX)
                          Call CreateFallingText("-" & CLng(Abs(.FX)), i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                      End If
                      .X = Map.Walls(j).X - 22
                      .FX = -Abs(.FX) * 0.6 - 1
                      .FY = .FY * µ '0.85
                      For t = 1 To Abs(.FX) * 4
                          RandomAngle = Rnd * 180 + 90
                          Random = Rnd * 4 + 2
                          Call CreateShootStar(i, .X + 22, .Y, (Abs(.FX) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FX) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                      Next
                      Hitten = True
                  ElseIf .X - 22 < Map.Walls(j).X + Map.Walls(j).Width And .X > Map.Walls(j).X + Map.Walls(j).Width / 2 Then
                      If t <= 5 Then
                          Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                      Else
                          .HP = .HP - Abs(.FX)
                          Call CreateFallingText("-" & CLng(Abs(.FX)), i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                      End If
                      .X = Map.Walls(j).X + Map.Walls(j).Width + 22
                      .FX = Abs(.FX) * 0.6 + 1
                      .FY = .FY * µ '0.85
                      For t = 1 To Abs(.FX) * 4
                          RandomAngle = Rnd * 180 - 90
                          Random = Rnd * 4 + 2
                          Call CreateShootStar(i, .X - 22, .Y, (Abs(.FX) + Random) * Cos(RandomAngle * Pi / 180), (Abs(.FX) / 2 + Random) * Sin(RandomAngle * Pi / 180))
                      Next
                      Hitten = True
                  End If
              End If
              '&#211;&#195;&#203;&#219; &#206;&#193;&#218;&#197;&#202;&#210;&#206;&#194; —— &#206;&#193;&#223;&#199;&#192;&#210;&#197;&#203;&#220;&#205;&#206; &#207;&#208;&#206;&#194;&#197;&#208;&#200;&#210;&#220; :)
              For u = 1 To 4
                  Select Case u
                  Case 1
                      X = Map.Walls(j).X
                      Y = Map.Walls(j).Y
                  Case 2
                      X = Map.Walls(j).X + Map.Walls(j).Width
                      Y = Map.Walls(j).Y
                  Case 3
                      X = Map.Walls(j).X
                      Y = Map.Walls(j).Y + Map.Walls(j).Height
                  Case 4
                      X = Map.Walls(j).X + Map.Walls(j).Width
                      Y = Map.Walls(j).Y + Map.Walls(j).Height
                  End Select
                  If Sqr((.X - X) ^ 2 + (.Y - Y) ^ 2) <= 20 Then
                      t = Rnd * 99 + 1
                      If t <= 5 Then
                          Call CreateFallingText("JUST", i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(5), DSBPLAY_DEFAULT)
                      Else
                          .HP = .HP - Sqr(.FX ^ 2 + .FY ^ 2) / 1.4
                          Call CreateFallingText("-" & CLng(Sqr(.FX ^ 2 + .FY ^ 2) / 1.4), i, .X, .Y, 0, -1)
                          Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                      End If
                      '&#209;&#247;&#224;&#241; &#236;&#251; &#234;&#224;&#234; &#247;&#242;&#238;-&#237;&#232;&#225;&#243;&#228;&#252; &#240;&#224;&#241;&#241;&#247;&#232;&#242;&#224;&#229;&#236;!
                      Px = .X - X '&#238;&#242;&#237;&#238;&#241;&#232;&#242;&#229;&#235;&#252;&#237;&#238;&#229; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#229; &#239;&#238; X
                      Py = .Y - Y '&#238;&#242;&#237;&#238;&#241;&#232;&#242;&#229;&#235;&#252;&#237;&#238;&#229; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#229; &#239;&#238; Y
                      d2 = Px * Px + Py * Py '&#234;&#226;&#224;&#228;&#240;&#224;&#242; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#255;
                      
                      VPx1 = (Px * .FX + Py * .FY) * Px / d2 '\_&#239;&#229;&#240;&#239;&#229;&#237;&#228;&#232;&#234;&#243;&#235;&#255;&#240; i
                      VPy1 = (Px * .FX + Py * .FY) * Py / d2 '/
                      VNx1 = (Py * .FX - Px * .FY) * Py / d2 '\_&#237;&#238;&#240;&#236;&#224;&#235;&#252; i
                      VNy1 = (Px * .FY - Py * .FX) * Px / d2 '/
                      VPx2 = -VPx1
                      VPy2 = -VPy1
                      VNx2 = -VNx1
                      VNy2 = -VNy1
                      If Px * (VPx2 - VPx1) + Py * (VPy2 - VPy1) > 0 Then '&#247;&#242;&#238;&#225;&#251; &#237;&#229; &#241;&#235;&#232;&#239;&#224;&#235;&#232;&#241;&#252;
                          .FX = ((24 ^ (1 / 3) - 1 ^ (1 / 3)) * .FX + 2 * 1 ^ (1 / 3) * (VPx2 + VNx1)) / (24 ^ (1 / 3) + 1 ^ (1 / 3))
                          .FY = ((24 ^ (1 / 3) - 1 ^ (1 / 3)) * .FY + 2 * 1 ^ (1 / 3) * (VPy2 + VNy1)) / (24 ^ (1 / 3) + 1 ^ (1 / 3))
                          .FX = .FX - 1.5 * Cos(AngleFromTwoPoints(.X, .Y, X, Y) * Pi / 180)
                          .FY = .FY - 1.5 * Sin(AngleFromTwoPoints(.X, .Y, X, Y) * Pi / 180)
                          .X = .X + .FX
                          .Y = .Y + .FY
                      End If
                      If (.PushedBy = 0 And .PushedBy <> i) Then .PushedBy = i
                      .PushedByTime = PushedByTime
                      For t = 1 To Sqr(.FX ^ 2 + .FY ^ 2) * 1.4 + 10
                              RandomAngle = Rnd * 360
                              Random = Rnd * 5
                              Call CreateShootStar(i, _
                                  .X + 24 * Cos(AngleFromTwoPoints(.X, .Y, X, Y)), _
                                  .Y + 24 * Sin(AngleFromTwoPoints(.X, .Y, X, Y)), _
                                  ;(9 + Random) * Cos(RandomAngle * Pi / 180), _
                                  ;(5 + Random) * Sin(RandomAngle * Pi / 180))
                          ';/
                      Next 'stars
                      Hitten = True
                  End If 'distance
              Next
          Next
          
          If .HP <= 0 Then
              'If Hitten Then
                  Call CreateExplode(.X, .Y, 0, 0) ' .FX, .FY)
              'Else
              '    Call CreateExplode(.X, .Y, .FX / 3, .FY / 3)
              'End If
              If (.PushedBy > 0 And .PushedBy <> i) And Hitten Then
                  Player(.PushedBy).Frags = Player(.PushedBy).Frags + 1
                      Call CreateFallingText("FRAG!", .PushedBy, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
                      Call CreateFallingText("FRAG!", .PushedBy, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
                      Call CreateFallingText("FRAG!", .PushedBy, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
              ElseIf (.PushedBy = 0) And Hitten Then
                      .Frags = .Frags - 1
                      Call CreateFallingText("SUICIDER!", 5, .X, .Y, 0, 0)
              ElseIf (.PushedBy = i) And Hitten Then
                      .Frags = .Frags - 1
                      Call CreateFallingText("SUICIDER!", 5, .X, .Y, 0, 0)
              ElseIf (.PushedBy > 0) And Not Hitten Then
                  If (.PushedBy <> i) Then
                      Player(.PushedBy).Frags = Player(.PushedBy).Frags + 1
                      Call CreateFallingText("FRAG!", .PushedBy, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
                      Call CreateFallingText("FRAG!", .PushedBy, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
                      Call CreateFallingText("FRAG!", .PushedBy, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
                  Else
                      .Frags = .Frags - 1
                      Call CreateFallingText("SUICIDER!", 5, Player(.PushedBy).X, Player(.PushedBy).Y, 0, 0)
                  End If
              End If
              .FramesToRespawn = 75 * 5
          End If
      Else
          .FramesToRespawn = .FramesToRespawn - 1
          If .FramesToRespawn = 0 Then
              .X = .SpawnX
              .Y = .SpawnY
              .FX = 0
              .FY = 0
              .PushedBy = 0
              .PushedByTime = 0
              .HP = .MaxHP
          End If
      End If
    End With
Next

For i = 1 To MaxPlayers - 1
    For j = i To MaxPlayers
        If i <> j Then
            If Player(i).FramesToRespawn = 0 And Player(i).Exist And Player(j).Exist And Player(j).FramesToRespawn = 0 And Player(j).Exist And Player(i).Exist Then
                Px = Player(i).X - Player(j).X '&#238;&#242;&#237;&#238;&#241;&#232;&#242;&#229;&#235;&#252;&#237;&#238;&#229; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#229; &#239;&#238; X
                Py = Player(i).Y - Player(j).Y '&#238;&#242;&#237;&#238;&#241;&#232;&#242;&#229;&#235;&#252;&#237;&#238;&#229; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#229; &#239;&#238; Y
                d2 = Px * Px + Py * Py '&#234;&#226;&#224;&#228;&#240;&#224;&#242; &#240;&#224;&#241;&#241;&#242;&#238;&#255;&#237;&#232;&#255;
                If (d2 <= (24 + 24) ^ 2) And (d2 > 1) Then
                    VPx1 = (Px * Player(i).FX + Py * Player(i).FY) * Px / d2 '\_&#239;&#229;&#240;&#239;&#229;&#237;&#228;&#232;&#234;&#243;&#235;&#255;&#240; i
                    VPy1 = (Px * Player(i).FX + Py * Player(i).FY) * Py / d2 '/
                    VNx1 = (Py * Player(i).FX - Px * Player(i).FY) * Py / d2 '\_&#237;&#238;&#240;&#236;&#224;&#235;&#252; i
                    VNy1 = (Px * Player(i).FY - Py * Player(i).FX) * Px / d2 '/
                    VPx2 = (Px * Player(j).FX + Py * Player(j).FY) * Px / d2 '\_&#239;&#229;&#240;&#239;&#229;&#237;&#228;&#232;&#234;&#243;&#235;&#255;&#240; j
                    VPy2 = (Px * Player(j).FX + Py * Player(j).FY) * Py / d2 '/
                    VNx2 = (Py * Player(j).FX - Px * Player(j).FY) * Py / d2 '\_&#237;&#238;&#240;&#236;&#224;&#235;&#252; j
                    VNy2 = (Px * Player(j).FY - Py * Player(j).FX) * Px / d2 '/
                    If Px * (VPx2 - VPx1) + Py * (VPy2 - VPy1) > 0 Then '&#247;&#242;&#238;&#225;&#251; &#237;&#229; &#241;&#235;&#232;&#239;&#224;&#235;&#232;&#241;&#252;
                        Player(i).FX = ((24 ^ (1 / 3) - 24 ^ (1 / 3)) * Player(i).FX + 2 * 24 ^ (1 / 3) * (VPx2 + VNx1)) / (24 ^ (1 / 3) + 24 ^ (1 / 3))
                        Player(i).FY = ((24 ^ (1 / 3) - 24 ^ (1 / 3)) * Player(i).FY + 2 * 24 ^ (1 / 3) * (VPy2 + VNy1)) / (24 ^ (1 / 3) + 24 ^ (1 / 3))
                        Player(j).FX = ((24 ^ (1 / 3) - 24 ^ (1 / 3)) * Player(j).FX + 2 * 24 ^ (1 / 3) * (VPx1 + VNx2)) / (24 ^ (1 / 3) + 24 ^ (1 / 3))
                        Player(j).FY = ((24 ^ (1 / 3) - 24 ^ (1 / 3)) * Player(j).FY + 2 * 24 ^ (1 / 3) * (VPy1 + VNy2)) / (24 ^ (1 / 3) + 24 ^ (1 / 3))
                        '&#207;&#238;&#241;&#235;&#229; &#241;&#242;&#238;&#235;&#234;&#237;&#238;&#226;&#229;&#237;&#232;&#255; &#234;&#238;&#240;&#224;&#225;&#232;&#234;&#232; &#226;&#241;&#229; &#230;&#229; &#240;&#224;&#231;&#235;&#229;&#242;&#224;&#254;&#242;&#241;&#255;
                        Player(i).FX = Player(i).FX - 2 * Cos(AngleFromTwoPoints(Player(i).X, Player(i).Y, Player(j).X, Player(j).Y) * Pi / 180)
                        Player(i).FY = Player(i).FY - 2 * Sin(AngleFromTwoPoints(Player(i).X, Player(i).Y, Player(j).X, Player(j).Y) * Pi / 180)
                        Player(j).FX = Player(j).FX - 2 * Cos(AngleFromTwoPoints(Player(j).X, Player(j).Y, Player(i).X, Player(i).Y) * Pi / 180)
                        Player(j).FY = Player(j).FY - 2 * Sin(AngleFromTwoPoints(Player(j).X, Player(j).Y, Player(i).X, Player(i).Y) * Pi / 180)
                    End If
                    Player(i).PushedBy = j
                    Player(i).PushedByTime = PushedByTime
                    Player(j).PushedBy = i
                    Player(j).PushedByTime = PushedByTime
                    For t = 1 To 20
                            RandomAngle = Rnd * 360
                            Call CreateShootStar(i - CBool(Rnd <= 0.5) * (j - i), _
                                Player(i).X + 24 * Cos(AngleFromTwoPoints(Player(i).X, Player(i).Y, Player(j).X, Player(j).Y)), _
                                Player(i).Y + 24 * Sin(AngleFromTwoPoints(Player(i).X, Player(i).Y, Player(j).X, Player(j).Y)), _
                                ;(7 + Rnd * 5) * Cos(RandomAngle * Pi / 180), _
                                ;(7 + Rnd * 5) * Sin(RandomAngle * Pi / 180))
                        ';/
                    Next
                    Call PlaySound(dsHit(1), DSBPLAY_DEFAULT)
                End If
            End If
        End If
    Next
Next
End Sub

Ответить

Номер ответа: 17
Автор ответа:
 Smith



ICQ: adamis@list.ru 

Вопросов: 153
Ответов: 3632
 Профиль | | #17 Добавлено: 04.06.08 12:45
без языка получилось бы красивее

Ответить

Страница: 1 | 2 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам