My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects)
My First Game (moving objects) My First Game (moving objects)
My First Game (moving objects)
Go Back  Xtreme Visual Basic Talk > > > My First Game (moving objects)


Reply
 
Thread Tools Display Modes
  #41  
Old 09-15-2004, 01:52 PM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default


Ok right now Im trying to make it so the paddles cannot leave the screen it works for one paddle but no the second here is my code

Code:
    Private Sub RPaddle_KeyDown(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        Me.Validate()
        If GameReady = True Then
            If RPaddle.Bottom > Me.ClientSize.Height Then
                If e.KeyCode = Keys.W Then
                    RPaddle.Offset(UpX, UpY)
                End If
            ElseIf RPaddle.Top < 0 Then
                If e.KeyCode = Keys.S Then
                    RPaddle.Offset(DownX, DownY)
                End If
            End If
            If RPaddle.Top > 0 Then
                If e.KeyCode = Keys.W Then
                    RPaddle.Offset(UpX, UpY)
                End If
            End If
            If RPaddle.Bottom < Me.ClientSize.Height Then
                If e.KeyCode = Keys.S Then
                    RPaddle.Offset(DownX, DownY)
                End If
            End If
        End If


        If GameReady = True Then
            If BPaddle.Bottom > Me.ClientSize.Height Then
                If e.KeyCode = Keys.Up Then
                    BPaddle.Offset(UpX, UpY)
                End If
            ElseIf BPaddle.Top < 0 Then
                If e.KeyCode = Keys.Down Then
                    BPaddle.Offset(DownX, DownY)
                End If
            End If
            If BPaddle.Top > 0 Then
                If e.KeyCode = Keys.Up Then
                    BPaddle.Offset(UpX, UpY)
                End If
            End If

            If BPaddle.Bottom < Me.ClientSize.Height Then
                If e.KeyCode = Keys.Down Then
                    BPaddle.Offset(DownX, DownY)
                End If
            End If
        End If
    End Sub
Why for Rpaddle it works but for Bpaddle its doesnt
Reply With Quote
  #42  
Old 09-15-2004, 05:03 PM
Iceplug's Avatar
IceplugMy First Game (moving objects) Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Hmmm... they look identical. I don't see why one would work and the other doesn't.
Maybe, you should be calling Invalidate() instead of Validate() at the top?

Also, the first two blocks under each If GameReady = True block can be removed, because the following two blocks check the same range of values and more.

And, the two If GameReady = True Then blocks can be lumped into one.
(by removing the End If and the If GameReady = True lines in the middle).
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #43  
Old 09-15-2004, 07:01 PM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default

How do you suggest I fix this Ive tryed everything you said and also how would I increment the score I tried and that didnt work
Reply With Quote
  #44  
Old 09-16-2004, 07:55 AM
Iceplug's Avatar
IceplugMy First Game (moving objects) Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Did you make the changes that I suggested to make in the previous post?
What does your code look like now?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #45  
Old 09-16-2004, 08:19 AM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default

ICEPLUG IT WORKS. The problem had nothing to do with that at all it was somewhere else in the code. Im so happy it works now I would like to put it on my website how do you suggest I do this. And once again thanks so much Iceplug you have taught me so much
Reply With Quote
  #46  
Old 09-16-2004, 08:23 AM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default

Besides the question I just posted I only have two more. 1. for some reason since this game is two player if playerone is moving his paddle up and playertwo moves his paddle playerone stops moving.
Reply With Quote
  #47  
Old 09-16-2004, 08:24 AM
Iceplug's Avatar
IceplugMy First Game (moving objects) Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

You mean so that people can download your game?

Edit:
In order to have more than two people, you'd have to declare four more boolean variables (one to represent if W is pressed, if S is pressed, same for Up and Down).
In the KeyDown, you set the appropriate boolean to True.
In the KeyUp event, you set the appropriate boolean to False.

Now, you'll do the movement in the Timer, and instead of checking the KeyCode, you check the Boolean.

Let me know if you get stuck.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #48  
Old 09-16-2004, 08:33 AM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default

Ya I want to post it on my website people can download and play it
Reply With Quote
  #49  
Old 09-16-2004, 02:03 PM
Iceplug's Avatar
IceplugMy First Game (moving objects) Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Well, just zip up your project, put it on your webspace, and add a hyperlink to it.

How're the key booleans coming?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #50  
Old 09-16-2004, 09:01 PM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default

awsome
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects) My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects) My First Game (moving objects)
My First Game (moving objects)
My First Game (moving objects)
 
My First Game (moving objects)
My First Game (moving objects)
 
-->