|
-
April 11th, 2010, 10:43 AM
#1
Help with Tetris
i finished part 1 of "Creating your own Tetris game". When i started part 2, i added the label for "Score". i then ran the game and the words that is written on the panel, just give a flicker but doesn't show. when i removed the label, the word shows. i am using WS 2005 on a XP Pro machine.
Pls help.
-
April 12th, 2010, 01:09 AM
#2
Re: Help with Tetris
Download the code sample, and see what you messed up!
Or, just remove it, and try again, somewhere else.
-
April 12th, 2010, 01:55 AM
#3
Re: Help with Tetris
 Originally Posted by dglienna
Download the code sample, and see what you messed up!
Or, just remove it, and try again, somewhere else.
Thanx, i did do all that, but even the downloaded code does the same!
-
April 12th, 2010, 03:16 AM
#4
Re: Help with Tetris
I'll let Hannes deal with this, as he is the one that wrote the series. AFAIK, they work...
-
April 13th, 2010, 09:28 AM
#5
Re: Help with Tetris
Welcome to the Fourms Jakoe! 
Thank you for your interest in my article series :
http://codeguru.com/vb/gen/vb_misc/g...le.php/c16803/
And
http://www.codeguru.com//vb/gen/vb_m...cle.php/c17005
The third part will go live tomorrow 
Can you post your project here, in zipped format ? Please.
I have gone through my codes for both part 1 and 2, and played around with them, and still cannot reproduce this behaviour you are describing 
Hannes
-
April 14th, 2010, 03:13 AM
#6
-
April 14th, 2010, 03:36 AM
#7
Re: Help with Tetris
Hello again Jakoe!
This attached picture is what I get. It stays there the whole time, as it should. Only when Enter gets pressed, the game should start. I see that you haven't included the clsTetDisplay class, or made use of it 
What Operating System are you using ?
Last edited by HanneSThEGreaT; June 14th, 2010 at 05:46 AM.
-
April 14th, 2010, 06:46 AM
#8
Re: Help with Tetris
 Originally Posted by HanneSThEGreaT
Hello again Jakoe!
This attached picture is what I get. It stays there the whole time, as it should. Only when Enter gets pressed, the game should start. I see that you haven't included the clsTetDisplay class, or made use of it
What Operating System are you using ?
Hi Hannes, thanx for ur effort.
it works perfect on ur pc.
i wanted my form to display properly before i made the clsTetDisplay class, otherwise th debugging can get to heavy. 
i am using Win XP Pro and VS 2005
-
April 14th, 2010, 07:06 AM
#9
Re: Help with Tetris
OK, I see your point 
Let me try something, then get back to you
-
April 14th, 2010, 08:13 AM
#10
Re: Help with Tetris
Hello Jakoe!
OK, I think I have fixed your problem. I did add the clsTetDisplay class, and edited the Splash sub to use the clsTetDisplay class' ClearScreen method. Why?
Well, we are dealing with more than one Graphics object here, we are dealing with the Preview Window, the Main Game Window, the Splash Screen window, as well as the In memory image - which is buffered. The ClearScreen method ensure that an in meory graphic exists, then "paints it black" - like the Rolling Stones song - Paint It Black 
Here is what it looks like :
Code:
''' <summary>
''' Determine Existance Of In Memory Graphic
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function ValidGraphic() As Boolean
If Not (g Is Nothing) And Not (InMemoryGraphics Is Nothing) Then
Return True 'If There Is A Graphic In Memory
Else
Return False 'If Not
End If
End Function
''' <summary>
''' Erase Game Screen
''' </summary>
''' <remarks></remarks>
Public Sub ClearScreen()
'If No Valid Graphic, Do Nothing
If Not ValidGraphic() Then
Return
End If
'Create A Solid Black Brush
Dim ClearBrush As New SolidBrush(Color.Black)
'Fill The Rectangle With The Black Colour, Causing The Clearance of The Images
InMemoryGraphics.FillRectangle(ClearBrush, 0, 0, ScreenWidth, ScreenHeight)
End Sub
This is necessary, as we clear the in memory graphic at the end of the day.
I also added the Setup method to frmTet, and called it from the Form's constructor - frmTet.Designer.vb
The Setup method takes care of loading and initialising all the necessary class objects, for use.
I decided to take this route with my program, as it is much more organised, and cleaner. Grid code is separate, shape code is separate, Display code is separate, game code is separate.
I am attching your project here, and please let me know what the results are.
here is the link to part 3 BTW :
http://www.codeguru.com/vb/gen/vb_mi...cle.php/c17081
Last edited by HanneSThEGreaT; April 28th, 2010 at 07:40 AM.
-
April 14th, 2010, 01:41 PM
#11
Re: Help with Tetris
 Originally Posted by HanneSThEGreaT
Hello Jakoe!
OK, I think I have fixed your problem. I did add the clsTetDisplay class, and edited the Splash sub to use the clsTetDisplay class' ClearScreen method. Why?
Well, we are dealing with more than one Graphics object here, we are dealing with the Preview Window, the Main Game Window, the Splash Screen window, as well as the In memory image - which is buffered. The ClearScreen method ensure that an in meory graphic exists, then "paints it black" - like the Rolling Stones song - Paint It Black
Here is what it looks like :
Code:
''' <summary>
''' Determine Existance Of In Memory Graphic
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function ValidGraphic() As Boolean
If Not (g Is Nothing) And Not (InMemoryGraphics Is Nothing) Then
Return True 'If There Is A Graphic In Memory
Else
Return False 'If Not
End If
End Function
''' <summary>
''' Erase Game Screen
''' </summary>
''' <remarks></remarks>
Public Sub ClearScreen()
'If No Valid Graphic, Do Nothing
If Not ValidGraphic() Then
Return
End If
'Create A Solid Black Brush
Dim ClearBrush As New SolidBrush(Color.Black)
'Fill The Rectangle With The Black Colour, Causing The Clearance of The Images
InMemoryGraphics.FillRectangle(ClearBrush, 0, 0, ScreenWidth, ScreenHeight)
End Sub
This is necessary, as we clear the in memory graphic at the end of the day.
I also added the Setup method to frmTet, and called it from the Form's constructor - frmTet.Designer.vb
The Setup method takes care of loading and initialising all the necessary class objects, for use.
I decided to take this route with my program, as it is much more organised, and cleaner. Grid code is separate, shape code is separate, Display code is separate, game code is separate.
I am attching your project here, and please let me know what the results are.
here is the link to part 3 BTW :
http://www.codeguru.com/vb/gen/vb_mi...cle.php/c17081
Hi Hannes,
thank you for all your effort, i really appreciate ur help.
the game is still doing the same , is there maby any settings that i can change?
thanx for the link.
A VERY strange thing is happening, the part 3 still doesn't have the splsh scren but, when i press enter, the game works perfectly...?
i played part 3 and when i pressed Q, the game stopped and AMAZINGLY the splash showed but, as i stopped the debugging and started it again, there were no splash again.
Jaco
Last edited by Jakoe; April 14th, 2010 at 02:27 PM.
-
April 15th, 2010, 07:19 AM
#12
Re: Help with Tetris
Hello again Jaco!
Hmm, I'll have to further investigate this on Part 2 - if anyone else can confirm the same results that you have had, I'll have a deeper look. I think it may be the timer causing this issue in part 3.
-
April 15th, 2010, 12:16 PM
#13
Re: Help with Tetris
 Originally Posted by HanneSThEGreaT
Hello again Jaco!
Hmm, I'll have to further investigate this on Part 2 - if anyone else can confirm the same results that you have had, I'll have a deeper look. I think it may be the timer causing this issue in part 3.
Hi Hannes
Thanx for ur help, meanwhile i will also go on and see what i can do. 
i have tried removing the timer but, nothing.
i appreciate ur help, thanx.
-
April 15th, 2010, 01:49 PM
#14
Re: Help with Tetris
Hello Jaco - are your frm South Africa BTW? Jaco is quite a common name here 
I haven't helped much! You have actually helped me by discovering these issues, so I must thank you! 
I'm still investigating this, we'll get it sorted - do not worry
-
April 16th, 2010, 01:11 AM
#15
Re: Help with Tetris
 Originally Posted by HanneSThEGreaT
Hello Jaco - are your frm South Africa BTW? Jaco is quite a common name here
I haven't helped much! You have actually helped me by discovering these issues, so I must thank you!
I'm still investigating this, we'll get it sorted - do not worry 
Hi Hannes, yes i am from S.A., Pretora. I am also wondering about you, since ur name and surname sounds South African. 
i think something is wrong with my system, i started to debug the game, i left it right after it started, when i came back ater almost 45 min, the game was displaying properly.
When i stopped it and started it again, same thing again.
in the setUp method, where did you declare grdGame ...
i also get this error:
Value of type 'Jetris.clsTetDisplay' cannot be converted to 'Jetris.clsTetGrid'.
when i add this code:
'initialse game object
scrGame = New clsTetDisplay(pnlTetGame, rctScreen)
i don't know how to post my cde like u did the ther day
Enjoy ur day
Last edited by Jakoe; April 16th, 2010 at 02:56 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|