Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: Joe on December 08, 2005, 07:39:09 PM

Title: [VB] Reincarnation of Pacman!
Post by: Joe on December 08, 2005, 07:39:09 PM
http://www.javaop.com/~joe/rop/

Yeah. I'm up to the challenge (to some degree) of rewriting Pacman. I had the idea today in computer programming (I spent four hours out of seven in that lab, and had one good idea. Ugh.), and just had to do it.

Anyhow, I wrote clsScreen to hold a grid, 32x32 spaces, and procedures to move each square up down left and right, to set the value, to get the value, and to swap two positions. I've got modScreen which handles drawing this grid to a 32x32 control array of borderless frames on frmMain, which will later be used to hold images representing the players, vitamin pills, etc. Right now, the grid is holding a long, which is set to a random color in Form_Load. The sad part, this takes a good two seconds to load on a 2.8Ghz processor. Of course, its creating 32x32 controls, setting three values on each of them, filling up an array of 32x32 elements, reading them again, and then setting the read values to the BackColor of the frame. Lets see you do that in two seconds. Oh well, you'll live.

Random Color EXE (http://www.javaop.com/~joe/rop/randomcolor.exe)
Random Color Screenshot (http://www.javaop.com/~joe/rop/randomcolor.png).
Title: Re: [VB] Reincarnation of Pacman!
Post by: Joe on December 08, 2005, 09:06:04 PM
I have such vivid memories of pacman, that I managed to remember where most of the lines (http://www.javaop.com/~joe/rop/linesdrawn1.png) go!
Title: Re: [VB] Reincarnation of Pacman!
Post by: rabbit on December 09, 2005, 09:14:13 AM
In all 255 levels?
Title: Re: [VB] Reincarnation of Pacman!
Post by: Warrior on December 13, 2005, 08:27:09 PM
Wow...use GDI. That or DirectDraw or Direct3D for 2D drawing or something anything better than controls..
Title: Re: [VB] Reincarnation of Pacman!
Post by: MyndFyre on December 14, 2005, 11:15:12 AM
I think GDI+ will do nicely for you.  GDI+ is the unmanaged API wrapped by the .NET Framework's drawing tools (in the System.Drawing namespace).  It provides an excellent and broad range of drawing tools.

http://msdn.microsoft.com/library/?url=/library/en-us/gdicpp/GDIPlus/GDIPlusreference/flatapi.asp?frame=true

Assuming you're using VB, you'll need to use the flat API (which is what I linked you to) instead of the object-oriented equivalent.

Joe, if you're going to use VB, at least use VB.NET and learn something about object orientation! :P