JellyFish666 Posted May 9, 2008 Posted May 9, 2008 (edited) hmm I am not sure what I just got myself into lol.I got the basics done now to the hard part, I am not worried about the paddles for now first I want to try to get the ball hitting the walls and paddles nicely but not sure how any idea's doesn't even have to be about the ball.so far you can customize the game pretty easy which is nice not sure if theres a error with my if...then...endif but try and edit the variables and see if get a error, may be not but as long as you enter the correct information it seems to workPictures included with source Hereexpandcollapse popup;Settings $Game_Title = "Ping Pong" ;$Player_Score1 = 0 ;$Player_Score2 = 0 ;$Hide_Score = False ;Field $FieldWidth = 400 $FieldHeight = 400 ;$Play_Field_MinX = 0 ;$Play_Field_MinY = 0 ;$Play_Field_MaxX = 0 ;$Play_Field_MaxY = 0 $Pic_Width = 400 $Pic_Height = 400 $BackgroundColor = 0x00FFFF $BackgroundColorToggle = False $BackgroundPicture = True $RealSizeBackground = False $BackgroundPath = @ScriptDir & "\background.bmp" ;Ball $Ball_StartX = 80 $Ball_StartY = 0 $Ball_Width = 20 $Ball_Height = 20 ;$Ball_Speed = 3 $Ball_Pic = @ScriptDir & "\Ball.bmp" ;Paddle 1 $Paddle_Left1 = 0 $Paddle_Top1 = 0 $Paddle_Width1 = 33 $Paddle_Height1 = 64 ;$Paddle_Speed1 = 3 $Paddle_Pic1 = @ScriptDir & "\Paddle1.bmp" ;Paddle 2 $Paddle_Left2 = $FieldWidth -33 $Paddle_Top2 = 0 $Paddle_Width2 = 33 $Paddle_Height2 = 64 ;$Paddle_Speed2 = 3 $Paddle_Pic2 = @ScriptDir & "\Paddle2.bmp" #include <GUIConstants.au3> Global $SS_REALSIZEIMAGE $GUI = GUICreate($Game_Title, $FieldWidth , $FieldHeight , Default , Default , Default , $WS_EX_LAYERED) _Background() _Ball() _Paddle(1) _Paddle(2) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Ball() If FileExists($Ball_Pic) Then $Ball = GUICtrlCreatePic($Ball_Pic , $Ball_StartX , $Ball_StartY , $Ball_Width , $Ball_Height) Else _Error("Error" , "No Ball") EndIf EndFunc Func _Paddle($Pad) If $Pad = 1 Then If FileExists($Paddle_Pic1) Then $Paddle1 = GUICtrlCreatePic($Paddle_Pic1, $Paddle_Left1 , $Paddle_Top1 , $Paddle_Width1 , $Paddle_Height1) Else _Error("Error" , "Paddle image 1 missing.") EndIf ElseIf $Pad = 2 Then If FileExists($Paddle_Pic2) Then $Paddle2 = GUICtrlCreatePic($Paddle_Pic2, $Paddle_Left2 , $Paddle_Top2 , $Paddle_Width2 , $Paddle_Height2) Else _Error("Error" , "Paddle image 2 missing") EndIf Else _Error("Error" , "Paddles are not called proper.") EndIf EndFunc Func _Background() If $BackgroundColor = True Then GUISetBkColor($BackgroundColor , $GUI) ElseIf $BackgroundColorToggle = False Then GUISetBkColor(Default , $GUI) Else _Error("Error" , "Unknown Background Color.") EndIf If $BackgroundPicture = True Then If Not FileExists($BackgroundPath) Then _Error("Error" , "Unknown Background Picture Path.") Else If $RealSizeBackground = True Then $Table = GUICtrlCreatePic($BackgroundPath, 0, 0, $Pic_Width, $Pic_Height , $SS_REALSIZEIMAGE) ElseIf $RealSizeBackground = False Then $Table = GUICtrlCreatePic($BackgroundPath, 0, 0, $FieldWidth, $FieldHeight) Else _Error("Error" , "Real Picture Size.") EndIf EndIf ElseIf $BackgroundPicture = False Then _Error("Error" , "No Background Picture Enabled") Else _Error("Error" , "No Background Picture Enabled") EndIf EndFunc Func _Error($ErrorTitle , $ErrorText) MsgBox(16 , $ErrorTitle , $ErrorText) Exit EndFunc Func test() MsgBox(0 , "" , "test") EndFunc Edited May 9, 2008 by JellyFish666
monoceres Posted May 9, 2008 Posted May 9, 2008 Hi! Seems like a good start! Use these includes to have it working with the latest beta (which is now actually a release candidate) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Good luck! Broken link? PM me and I'll send you the file!
ludocus Posted May 9, 2008 Posted May 9, 2008 wow, this is going to be hard for you. But looking forward to result!
JellyFish666 Posted May 9, 2008 Author Posted May 9, 2008 (edited) well, I am not good with math or physics so it will be hard but once the ball is complete it should be easy from there. when the ball touches the paddle it should be pretty simple | | \ | | | | | / | | - make up the paddle and \ | / make up the direction the ball goes, so the more to the edge the better chance it has to bounce downwards or upwards but since this game can be customized the walls will need a form of math to detect the key points as well as the paddles and since the ball can also be customized it will all have to be done a certain way, but I think ill just make it and worry about the customizing later. It's amazing I thought it was a simple game but yet it's soo complexed. Edited May 9, 2008 by JellyFish666
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now