MARIO graphics flicker, file attached

oh, thanks for fixing the problem
the very LAST thing:D im gonna ask is(yes, i ask too many questions):

i have the collision detection for the blocks. But when you jump left and right and you hit the blocks, what happens is it doesnt work, but when you stand underneath the block and hit it, it works.. and btw.. my "destroyed block" names are DestroyedBLock1, DestroyedBlock2.. all the way up through 5

the only problem is, it displays only one block, after you hit the next, the original disappears..

and Can i display a new level after closing the first level?

thank you so much for ur help :cool:, i tend to get confused in some of the -technical- aspects of game programming :confused:

the file is attached

oh, sorry about the label at the top of the form, i use it to check for some of the collision detection values! wow, mutant ur like the only one who actualy answers my questions
 

Attachments

Last edited by a moderator:
Can you explain this part of the code? Im not really sure what it is suposed to do :)
Code:
            If pt.X >= 100 And pt.X <= 131 Then
                BlockValue = 1 All the BlockValue code will be of use later, not now
                bPT.X = 118
                Me.Invalidate()
            End If

            If pt.X >= 120 And pt.X <= 151 Then
                BlockValue = 2
                bPT.X = 148
                Me.Invalidate()
            End If

            If pt.X >= 216 And pt.X <= 247 Then
                BlockValue = 3
                bPT.X = 238
                Me.Invalidate()
            End If

            If pt.X >= 307 And pt.X <= 338 Then
                BlockValue = 4
                bPT.X = 328
                Me.Invalidate()
            End If

            If pt.X >= 332 And pt.X <= 363 Then
                BlockValue = 5
                bPT.X = 357
                Me.Invalidate()
            End If
 
oh

alright
notice how the blocks are the same height?
ok bPT is the coordinates for the destroyed block
thats bPT.Y, its always gonna be the same height

so, when what happens is, when mario goes to a certain point:
If pt.X >= 100 And pt.X <= 131
then the bPT value will be set. Once the bPT value is set, a destroyed block image replaces(or goes on top of) the original block image.. Basically the bPT value is the coordinates for the destroyed block image. The Destroyed block image has a red question mark.

Ok
as for the BlockValue = 1, theres a bunch of DestroyedBLock images(actually Five, one for each block, the destroyed block images: DestroyedBlock1.bmp, destroyedblock2.bmp)
so what im trying to do is:

If mario gets between a certain point:
If pt.X >= 100 And pt.X <= 131
In this case he would be underneath block 1
set the block value to 1
invalidate the form
when it goes to form1.paint:
it will say
e.drawgraphics(new bitmap(blockimg), bPT)
by the way:
blockimg = "DestroyedBlock" & BlockValue ".bmp"
when the form loads it sets the bPT.Y to like 253 or something
because the blocks are all the same height

what i was trying to do was display 5 different blocks by using the blockValue and saying, on the first block display DestroyedBlock1
on the second block display destroyedBlock2. But what happens is, the first block goes away and the second one appears :( i cant get it to work

bottm line:
the code you posted above is the collision detection stuff ;)
 
Replace that piece of code with:
Code:
        If pt.Y = 265 Then if mario is in the height of the box
            If pt.X >= 100 And pt.X <= 121 Then
                BlockValue = 1 All the BlockValue code will be of use later, not now
                bPT.X = 118
                Me.Invalidate()
            ElseIf pt.X >= 130 And pt.X <= 151 Then
                BlockValue = 2
                bPT.X = 148
                Me.Invalidate()
            ElseIf pt.X >= 216 And pt.X <= 247 Then
                BlockValue = 3
                bPT.X = 238
                Me.Invalidate()
            ElseIf pt.X >= 307 And pt.X <= 338 Then
                BlockValue = 4
                bPT.X = 328
                Me.Invalidate()
            ElseIf pt.X >= 332 And pt.X <= 363 Then
                BlockValue = 5
                bPT.X = 357
                Me.Invalidate()
            End If
        End If
        If pt.Y = 300 Then
            jumpinc = 5 return to jumping up
            jumpheight = 0 return to normal position
            jumping = False not jumping anymore
            marioimage = "marioright0.bmp" default image
            JumpTimer.Enabled = False disbale timer
            jr2 = False
            jl2 = False
            Me.Invalidate() repaint form
            Exit Sub
        End If

You see, what you were doing is checking what block to draw when mario was back on the ground, which would light up the box over him when he lands. You have to check for the box when he is at the height of the boxes.
:)
 
Last edited by a moderator:
By appear you mean just have another box drawn?
Then, yes, e.graphics.drawimage is all you need to draw another one.
Correct me if im talking about the wrong thing, im not sure what you mean :)
 
actualy, you cant do that :(
Code:
Declarations

    Dim BlockImage As String
    Dim BlockImage2 As String
    Dim BlockImage3 As String
    Dim BlockImage4 As String
    Dim BlockImage5 As String

i declaraed 5 block images in declarations

Code:
Form1.Paint
 If Not bPT.X = 0 Then
            If bPT.X = 118 Then
                Dim BlockImg As New Bitmap(BlockImage)
                BlockImg.MakeTransparent(Color.Lime)
                e.Graphics.DrawImage(New Bitmap(BlockImg), bPT)
            End If

            If bPT.X = 148 Then
                Dim BlockImg2 As New Bitmap(BlockImage2)
                BlockImg2.MakeTransparent(Color.Lime)
                e.Graphics.DrawImage(New Bitmap(BlockImg2), bPT)
            End If
        End If

i only did this for 2 blocks, they dont work.. by the way under Form1.Load, i Changed this:
Code:
Form1.Load
        BlockImage = "DestroyedBlock1.bmp"
        BlockImage2 = "DestroyedBlock2.bmp"
        BlockImage3 = "DestroyedBlock3.bmp"
        BlockImage4 = "DestroyedBlock4.bmp"
        BlockImage5 = "DestroyedBlock5.bmp"

Even tho i did it for 2 blocks, it still wont work :( it will only display 1


btw. when i said if bPT.X = 118 or 148, look in the collision dection thing u posted above... its just saying that "if you hit block 1" or "If you hit block2"
 
Last edited by a moderator:
and i took away the block value thing
what i THINK is happeining is when you go under form1.paint and oyu say If bPT.X = 118 Then blah
and you say If bPT.x = 148 Then blah

whats happenin is: when u hit the first block bPT.X = 118, so it paints the destroyed block
and when u hit the 2nd block bPT.X = 148, so it paints the destroyed block2. whats happenin is.. form1.paint does the If bPT.x = 118 events only when its 118, but when it changes, it removes those events so what im gonna do is:

Code:
If pt.Y = 265 Then if mario is in the height of the box
            If pt.X >= 100 And pt.X <= 121 Then

                bPT.X = 118
                hitfirstblock = true
                Me.Invalidate()
im just gonna say something like in form1.paint
if hitfirstblock = true then
blah
 
Back
Top