I deleted the exe's and zipped it to the highest compression and it is now 1.56 MB, which is more than the 250k limit. Please download it from the link in my previous post from rapidshare. No viruses.
Printable View
I deleted the exe's and zipped it to the highest compression and it is now 1.56 MB, which is more than the 250k limit. Please download it from the link in my previous post from rapidshare. No viruses.
Hello, I am posting this so that my problem resets to the top of the forum. Please help!
Well, to be honest, I tried to go to rapidshare.com. It seems as if I have to register or something just to be able to download files. Can I get these files without registering at that site, many people ( including me ), won't register at hundreds of places
You don't have to register and i wouldn't expect you to. All you need to do is:
1.) Scroll down to the Select Your Download section and click "Free".
2.) Scroll down till you see the characters (numbers and letters) and enter them in the box below and press Download via Level(3) #4.
3.) Select your download location and whala.
OK, I finally had time to download your project files. I guess I miss read that web page, or I was just a bit hurried.
I have played around with it, and it seems as if I have reduced the flickering somewhat - there is still flickering. I have also noticed that the quicker the picture moves, the less flickering happens - that I found interesting, and that is what I'm investigating now.
By the weekend, I hope I could have this solved for you, that is if you don't mind ¿ ;) :)
I've also figured out why your zipped / Rarred version is still so big : it is mainly about the beautiful background image of the form. Also, by deleting the OBJ and DEBUG folders, I have reduced the zip to 1.56 MB. If the background picture wasn't so big in size, we wouldn't have had this problem in uploading the file here :) ;)
Thanks for taking the time to download the project and please take as much time as you need to investigate and solve this problem. Next time, i will make sure to delete the obj and debug folders and make sure that my graphics aren't using up so much space. Thanks again.
Sorry, just posting again to refresh this topic to the top of the forum. Any thoughts guys?
Hello again TCanuck42! :)
OK, firstly, I didn't have much time over the weekend ( car troubles again - but that's besides the topic ).
I ended up doing this :
Now, on my work PC, it does not show any flickering, try it, perhaps you get the same result - if not, I think I may have pinpointed another ( or the same ) problem. :)Code:Public Class isJadefortD5
Public chardir As String
Public currplayerpic As PictureBox
Private Sub isJadefortD5_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Call MovePlayer(player, e.KeyCode, Me)
CheckCols(e.KeyCode)
End Sub
Private Sub isJadefortD5_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If pANI.Enabled = True Then Call StopMovePlayer(player)
End Sub
'Public Sub New()
' MyBase.New()
' SetStyle(ControlStyles.DoubleBuffer, True)
' SetStyle(ControlStyles.UserPaint, True)
' SetStyle(ControlStyles.AllPaintingInWmPaint, True)
' Me.InitializeComponent()
'End Sub
' Set the value of the double-buffering style bits to true.
Public Sub EnableDoubleBuffering()
' Set the value of the double-buffering style bits to true.
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint, _
True)
Me.UpdateStyles()
End Sub
Private Sub CheckCols(ByVal key As Long)
'up on home and trees
If key = Keys.Up And player.Top < 167 Then
player.Top = player.Top + 10
End If
'right on stumps
If key = Keys.Right And player.Left > 734 Then
player.Left = player.Left - 10
End If
'down on trees
If key = Keys.Down And player.Top > 431 Then
player.Top = player.Top - 10
End If
'up on tree to left
If key = Keys.Up And player.Left < 58 And player.Top < 289 Then
player.Top = player.Top + 10
End If
'left on path
If player.Left < 0 Then
player.Left = player.Left + 10
End If
End Sub
Public Sub MovePlayer(ByVal player As PictureBox, ByVal key As Long, ByVal parent As Form)
'check for keys
If key = Keys.Up Then
player.Top = player.Top - 10
CharDir = "up"
End If
If key = Keys.Down Then
player.Top = player.Top + 10
CharDir = "down"
End If
If key = Keys.Left Then
player.Left = player.Left - 10
CharDir = "left"
End If
If key = Keys.Right Then
player.Left = player.Left + 10
CharDir = "right"
End If
'transparent
player.Parent = parent
'start animation
If pANI.Enabled = False Then pANI.Enabled = True
currplayerpic = player
End Sub
Public Sub StopMovePlayer(ByVal player As PictureBox)
EnableDoubleBuffering()
'kill animation timer
If pANI.Enabled = True Then pANI.Enabled = False
'reset stand image
Select Case chardir
Case Is = "right"
player.Image = pRight.Image
Case Is = "down"
player.Image = pDown.Image
Case Is = "left"
player.Image = pLeft.Image
Case Is = "up"
player.Image = pUp.Image
End Select
End Sub
Private Sub isJadefortD5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
EnableDoubleBuffering()
End Sub
Private Sub pANI_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pANI.Tick
'EnableDoubleBuffering()
Static frame As Integer = 1
Select Case frame
Case Is = 1
If chardir = "right" Then currplayerpic.Image = rightani1.Image
If chardir = "left" Then currplayerpic.Image = leftani1.Image
If chardir = "up" Then currplayerpic.Image = backani1.Image
If chardir = "down" Then currplayerpic.Image = frontani1.Image
EnableDoubleBuffering()
frame = 2
Case Is = 2
If chardir = "right" Then currplayerpic.Image = rightani2.Image
If chardir = "left" Then currplayerpic.Image = leftani2.Image
If chardir = "up" Then currplayerpic.Image = backani2.Image
If chardir = "down" Then currplayerpic.Image = frontani2.Image
EnableDoubleBuffering()
frame = 1
End Select
End Sub
End Class
Thanks for dedicating your time to solving this issue. Hopefully your car troubles have been fixed =). Anyways, my project now has many forms, and on the keydown event and keyup event on each of the many forms (or in game screens), a sub is called in a module that carries out the movement segment of the game. The sub takes in arguments involving the form and player picturebox so that the sub can be used for each form. how can i incorporate your buffering sub into my module so that it can be used universally so I don't need to copy and paste the code into each form.
I tried to do what i am asking of and added a form argument to the sub. I then changed the me.blah to frm.blah and it didn't compile correctly. Any thoughts?
No need for the arguments :)
You see, the EnableDoubleBuffering is already Public, meaning it can be accessed everywhere in your program. You could just try a simple line like this :
on the forms, and it should work OK.Code:isJadefortD5.EnableDoubleBuffering()
I hope it helps !
I added the code to my module and it said the "Me" was an invalid identifier in a module. Ignoring that for the moment, in my player moving event in the module, it will not allow me to use the form argument with the enabledoublebuffering sub. If there is no argument, how can the program know which form to act upon? Thanks in advance
============Edit=====================
Do you mean that if one of my forms has the enabledoublebuffering sub and i call it from another form, it will work effectively on others?
OK, take a look at this :
Then, the call(s) :Code:Public Sub EnableDoubleBuffering(ByVal CurrentForm As System.Windows.Forms.Form)
' Set the value of the double-buffering style bits to true.
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint, _
True)
Me.UpdateStyles()
End Sub
Is that what you're after ¿Code:EnableDoubleBuffering(Me)
Sorry for the confusion. I have played around with the EnableDoubleBuffering sub and I tested it for just one form and movement function to remove the complexity and still, this is a subtle blinking. Earlier you said if this was not the case, you suspected of another cause. Can you please explain? Many thanks
Hello again! I totally forgot about this :blush:
It seems there will always be some blinking :( At one stage I thought the results I'm getting was because of my Display cards, but that wasn't the case.
Have you considered using DirectX for smoother animations ¿
TCanuck42, I haven't forgotten about you, or this issue. I tried conatcting you through email or PM, but sadly both are disabled.
I did find this very interesting article about flicker free drawing :
http://www.codeguru.com/Csharp/Cshar...cle.php/c6137/
Just one drawback, it's in C#. But, the author is making use of various APIs which can also be used through VB as well.
Just thought I'd let you know.. :)