ka2na
Oct 13, 2011, 08:47 PM
Hi I was wondering do any of you know the software programme where you make programmes and software through lines and lines of coding, anyway I am making the game airhockey, but a virtual version which yes is similar to pong. I was wondering how to I get my rectangle shape to move smoothly, and not appear in random spots, thank you. This is what I have coded thus far. Your feed back would be much appreciated
'properties
Color = "Black"
GraphicsWindow.CanResize = "true"
SetUpWindow()
Sub SetUpWindow
GraphicsWindow.Width = Desktop.Width
GraphicsWindow.Height = Desktop.Height
GraphicsWindow.Left = 0
GraphicsWindow.Top = 0
GraphicsWindow.Height = 1000
GraphicsWindow.BackgroundColor = "Aqua"
GraphicsWindow.DrawRectangle(796,1,2,10000)
GraphicsWindow.DrawEllipse(750.5,394,100,100)
EndSub
SetUpShapes()
Sub SetUpShapes
ellipse = Shapes.AddEllipse(10,10)
rectangle = Shapes.AddRectangle(40,80)
ball = Shapes.AddEllipse(50,50)
EndSub
Shapesmove()
Sub ShapesMove
GraphicsWindow.MouseDown = OnMouseDown
EndSub
Sub OnMouseDown
x = GraphicsWindow.MouseX
why = GraphicsWindow.MouseY
Shapes.Animate(ball,x,why,700)
x = GraphicsWindow.MouseX
why = GraphicsWindow.MouseY
Shapes.Animate(rectangle,x,why,400)
EndSub
'properties
Color = "Black"
GraphicsWindow.CanResize = "true"
SetUpWindow()
Sub SetUpWindow
GraphicsWindow.Width = Desktop.Width
GraphicsWindow.Height = Desktop.Height
GraphicsWindow.Left = 0
GraphicsWindow.Top = 0
GraphicsWindow.Height = 1000
GraphicsWindow.BackgroundColor = "Aqua"
GraphicsWindow.DrawRectangle(796,1,2,10000)
GraphicsWindow.DrawEllipse(750.5,394,100,100)
EndSub
SetUpShapes()
Sub SetUpShapes
ellipse = Shapes.AddEllipse(10,10)
rectangle = Shapes.AddRectangle(40,80)
ball = Shapes.AddEllipse(50,50)
EndSub
Shapesmove()
Sub ShapesMove
GraphicsWindow.MouseDown = OnMouseDown
EndSub
Sub OnMouseDown
x = GraphicsWindow.MouseX
why = GraphicsWindow.MouseY
Shapes.Animate(ball,x,why,700)
x = GraphicsWindow.MouseX
why = GraphicsWindow.MouseY
Shapes.Animate(rectangle,x,why,400)
EndSub