ThePentiumGuy Posted June 2, 2003 Posted June 2, 2003 (edited) I made Mario In VB.nET but the graphics flicker, can someone fix this, i uploaded it. I dunno if i should use DIrectXmario.zip Edited September 26, 2004 by PlausiblyDamp Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 2, 2003 Author Posted June 2, 2003 I think you need to extract it to this directory: C:\My Visual Studio Projects\ and it will automatically add the Mario Folder, you need Winzip to extract or you could use WinRAR Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 2, 2003 *Experts* Posted June 2, 2003 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. Quote
ThePentiumGuy Posted June 2, 2003 Author Posted June 2, 2003 yeah but i cant find a good tutoral anywhere for GTI+ Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 2, 2003 *Experts* Posted June 2, 2003 (edited) 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 :) Edited June 3, 2003 by mutant Quote
*Experts* mutant Posted June 3, 2003 *Experts* Posted June 3, 2003 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. Quote
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 this is absoultely amazing! awesome! the only question i got is, when i had the Graphics as ICons, they were transparent, how do you make the Mario background transparent? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 3, 2003 *Experts* Posted June 3, 2003 :) 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. Quote
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 wow you seem to know a lot mutant , thanks so, GDI+ isn't another DLL like DirectX that you have to import, its built right on the framework Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 can i use Icons instead of Bitmaps, or is that not recommended Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 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 didn't work either Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 I figured it out instead of e.Graphics.DrawImage you use e.graphics.drawIcon Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 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 Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 3, 2003 *Experts* Posted June 3, 2003 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) 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 Quote
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 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 Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 3, 2003 *Experts* Posted June 3, 2003 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. Quote
ThePentiumGuy Posted June 3, 2003 Author Posted June 3, 2003 oh i got it when you put Dim marioimg As New Bitmap(marioimage) in the Declarations space it doesnt work but when you put it in the level1.paint it works thanx! Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 5, 2003 Author Posted June 5, 2003 (edited) jumping.. in the jumping event, i want mario to Jump, but, if he's 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?pcmario.zip Edited September 26, 2004 by PlausiblyDamp Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 7, 2003 *Experts* Posted June 7, 2003 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 :) Quote
*Experts* mutant Posted June 7, 2003 *Experts* Posted June 7, 2003 Opps. Sorry forgot the attachment :) Quote
ThePentiumGuy Posted June 8, 2003 Author Posted June 8, 2003 (edited) 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 questionspcmario.zip Edited September 26, 2004 by PlausiblyDamp Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted June 11, 2003 Author Posted June 11, 2003 btw, does anyone else wanna help, not in a bad way, mutant, but i mean he's been contributing for this thread a lot ;) Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 11, 2003 *Experts* Posted June 11, 2003 Can you explain this part of the code? Im not really sure what it is suposed to do :) 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 Quote
ThePentiumGuy Posted June 11, 2003 Author Posted June 11, 2003 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, there's 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 ;) Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted June 11, 2003 *Experts* Posted June 11, 2003 (edited) Replace that piece of code with: 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. :) Edited June 11, 2003 by mutant Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.