none
Path Finder | Help :( RRS feed

  • Question

  • Intialize()
    Sub Intialize
      GraphicsWindow.Width=800
      GraphicsWindow.Height=600
      GraphicsWindow.CanResize="False" 'player can't resize screen
      GraphicsWindow.Top=5
      GraphicsWindow.Left=5
      GraphicsWindow.MouseUp=onMouseUp
      GraphicsWindow.MouseDown=OnMouseDown
      GraphicsWindow.MouseMove=OnMouseMove
      MouseDown="False"
      Timer.Interval=1000 '1 second
      Timer.Tick=timetick
      Time=0
      Mouse.ShowCursor() 'show cursor
      Units()
      Select=0
    EndSub
    Sub OnMouseMove
      GraphicsWindow.Title = "Mouse X = " + GraphicsWindow.MouseX + ",    Mouse Y = " + GraphicsWindow.MouseY
      MouseX=GraphicsWindow.MouseX
      MouseY=GraphicsWindow.MouseY
    EndSub
    Sub onMouseUp 'click and drag
      If MouseDown="True" and Select=0 Then     '[] rectangle - top left corner = 1 - top right corner = 2 - bottom left corner = 3 - bottom right corner = 4
        Shapes.Remove(Highlight)
        EndingX = GraphicsWindow.MouseX
        EndingY = GraphicsWindow.MouseY
        GraphicsWindow.BrushColor = "#40FFFF00" 'GraphicsWindow.BrushColor = "Transparent"
        If StartingX < EndingX and StartingY < EndingY Then 'click and drag down right
          Highlight=Shapes.AddRectangle(EndingX-StartingX,EndingY-StartingY)
          Shapes.Move(Highlight,StartingX,StartingY)
          TopLeftCornerX=StartingX
          TopLeftCornerY=StartingY
          TopRightCornerX=EndingX  
          BottomLeftCornerY=EndingY
        ElseIf StartingX > EndingX and StartingY < EndingY Then 'click and drag down left
          Highlight=Shapes.AddRectangle(StartingX-EndingX,EndingY-StartingY)
          Shapes.Move(Highlight,EndingX,StartingY)
          TopLeftCornerX=EndingX
          TopLeftCornerY=StartingY
          TopRightCornerX=StartingX
          BottomLeftCornerY=EndingY
        ElseIf StartingX < EndingX and StartingY > EndingY Then 'click and drag up right
          Highlight=Shapes.AddRectangle(EndingX-StartingX,StartingY-EndingY)
          Shapes.Move(Highlight,StartingX,EndingY)
          TopLeftCornerX=StartingX
          TopLeftCornerY=EndingY
          TopRightCornerX=EndingX
          BottomLeftCornerY=StartingY
        ElseIf StartingX > EndingX and StartingY > EndingY Then 'click and drag up left
          Highlight=Shapes.AddRectangle(StartingX-EndingX,StartingY-EndingY)
          Shapes.Move(Highlight,EndingX,endingY)
          TopLeftCornerX=EndingX
          TopLeftCornerY=EndingY
          TopRightCornerX=StartingX
          BottomLeftCornerY=StartingY  
        EndIf
        If (CenterofUnitsX[1] > TopLeftCornerX and CenterofUnitsX[1] < TopRightCornerX) and (CenterofUnitsY[1] > TopLeftCornerY  and CenterofUnitsY[1] < BottomLeftCornerY) then
          Select=1
        else
          Select=0
        EndIf
        MouseDown="False"
      EndIf
      If MouseDown="True" and Select=1 then
        MouseDown="False"
        Select=0
        Shapes.Remove(Highlight)
        UnitsX[1]=GraphicsWindow.MouseX
        UnitsY[1]=GraphicsWindow.MouseY
        CenterofUnitsX[1]=UnitsX[1]+13
        CenterofUnitsY[1]=UnitsY[1]+13
        Shapes.Animate(Units[1],UnitsX[1],UnitsY[1],1000)
      EndIf
    EndSub
    Sub timetick
     
    EndSub
    Sub onMouseDown
      StartingX=GraphicsWindow.MouseX
      StartingY=GraphicsWindow.MouseY
      If Mouse.IsRightButtonDown Then 'deselect
        Shapes.Remove(Highlight)
      EndIf
      If Mouse.IsLeftButtonDown Then
        MouseDown="True"
      EndIf
    EndSub
    Sub Units
      Units[1]=Shapes.AddEllipse(26,26)
      UnitsX[1]=50
      UnitsY[1]=50
      CenterofUnitsX[1]=UnitsX[1]+13
      CenterofUnitsY[1]=UnitsY[1]+13
      Shapes.Move(Units[1],UnitsX[1],UnitsY[1])
    EndSub
    I need help moving the object to a location. I want it to go at the same speed anywhere it goes but I can't figure it out. I don't want to use shapes.animate or a program.delay since its going to mess up the game.




    • Edited by Dinomite07 Monday, April 27, 2015 2:26 AM
    Sunday, April 26, 2015 9:39 PM

Answers

All replies