MARIO graphics flicker, file attached

That game will be cool :)
But you gotta loose the picture boxes, they are slow. Draw your character with the GDI+ methods becuase you can take advantage of double buffering.
 
I changed some code to make it draw with GDI+ :)
Look through it, its not everything because i didnt have a lot of time.

To Mods: The bin folder only contains graphics so it easier to get the path, no executables.

Btw. Where did you get those graphics? I was looking for something like this for a long time to do my school project :)
 
Last edited by a moderator:
Oh, i made a little mistake :)
Instead of drawing the background in paint, set the background image of the form to that image. It will be a lot faster.
 
:)

Im not sure what is the excat name of the color that is the background of the bimap but you have to set the TransparenceKey of your form to match the color that is the background of the bitmap. When you do that the form will make the picked color transparent. Is the most common to use pink as the backgrounds as its not used so much, becuase it will make other things that you dont draw transparent too.
 
btw. (for testing puroses) set the background color to black and set the transparencykey to black. that didnt work

before
SetStyle(ControlStyles.AllPaintingInWmPaint, True) SetSTyle(ControlStyles.DoubleBuffer, True)
I added
Setstyle(ControlStyles.Opaque, True)
Setstyle(ControlStyles.SupportsTransparentBackColor, True)

with that, it didnt work either
 
do i need to add the reference
stdole.dll?
( i added the reference stdole.dll )

check this code out

Public Class Level1
Inherits System.Windows.Forms.Form


Private Sub Level1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

e.Graphics.DrawIcon(New Icon("marioright1"), 5, 5)

End Sub

End Class
 
Yes I know but I never really saw a game that used icons :)
And i fixed the problem :) I was thinking of the wrong thing. Put this code in the paint event: (assuming you want to make black transparent for example)
Code:
Dim marioimg As New Bitmap(marioimage)
marioimg.MakeTransparent(Color.Black)
e.Graphics.DrawImage(New Bitmap(marioimg), pt) draw the mario image at the specified point
 
error: marioimg cannot be null

Private Sub Level1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
marioimg.MakeTransparent(Color.Lime)
e.Graphics.DrawImage(New Bitmap(marioimg), pt)
End Sub


Private Sub Level1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetStyle(ControlStyles.AllPaintingInWmPaint, True) This will lower the flicker
SetSTyle(ControlStyles.DoubleBuffer, True) This will lower it too :)
pt = New Point(20, 300) starting point
marioimage = "marioright0.bmp" starting pic
imagecount = 0 starting piccount
flyimagecount = -1 starting flypiccount
jumpinc = 5 pixels on jump increase
End Sub
End Class
 
I dont see you declaring the marioimg anywhere like i did :) You are trying to modify a bitmap that wasnt even declared yet.
And the code I just posted works for me :) Copy the code excatly like i showed and it should work.
 
jumping..

in the jumping event, i want mario to Jump, but, if hes jumpinf right, he has to move right, and use the state, MarioRight1, or MarioLeft1

and

the important thing is.. i want the user to actually be pressing Right and Space at the Same time to jump Right.

and

for the scrolling should i use this format?

if <mario goes halfway through the screen> THen
<make the right edge of the form extended>
<Contract the left edge of the form>
<move the form left to appear as if nothin happened>
End If

But.. i dont know how to extend/contract the Left and Right edges of the form

i cant do, form1.left -= <something>
it will only move one side of the form

or, is there another way i can do scrolling?

the way i mentioned above can only be possible if you have control over the left and right sides of the form

Should i use a Media player as a MIDI player in my game? or does that take up too much memory?
 

Attachments

Last edited by a moderator:
I dont know if this will help you a lot :)
Now you have to press right slightly before space, almost the same time :) and mario will now not be able to move while jumping so if you jump right you go right until you get to ground :)
 
Back
Top