A Sprite demo for all you aspiring Bitblters

Garrett Sever
09-07-2001, 07:25 AM
All, I wrote this about a year ago when I first started my adventure into API and graphics programming. I wrote it for some young guy who had big ideas and no talent for game writing, and the project folded a little over two weeks after I was "accepted" as his pixel slinger.

I have no time for game programming anymore, and I thought some of you may benefit from ideas/code presented in this project. It shows a Final Fantasy V guy wandering around aimlessly... back and forth, into the distance and back up close... and only on a splash screen.

The coding isn't perfect, in fact at points it makes me want to wretch, and I make no claims about cleaning up resources, etc. As I said, it was written when I first started, so user beware images/icons/wink.gif

Regards,
-<font color=purple>The Hand</font color=purple>

<font color=green>All your code are belong to us...</font color=green> images/icons/tongue.gif

Teric
09-07-2001, 08:07 AM
Well, I downloaded your attachment, and I like the complexity that I see. I'm going to look through it more carefully to see if I can learn some things about using Classes in VB.

I ran the program, and saw your intro screen, but I did not see what you described (i.e. a character walking around). Am I missing something? NOTE: I am running Windows NT here at work.

Garrett Sever
09-07-2001, 09:30 AM
Hmmmm.... that concerns me. I wrote it on a Windows 95/98 system and have not tested it on NT.

Perhaps I need to modify the code to make it work for NT machines. I'll try to do that sometime in the next few days.

Regards,
-<font color=purple>The Hand</font color=purple>

<font color=green>All your code are belong to us...</font color=green> images/icons/tongue.gif

Laurent
09-07-2001, 10:19 AM
the hand i gotta say i love what you do to implement the interface, it changes the look like crazy without being anoying. i love it

I'll be among the best soon, very soon!!!

Garrett Sever
09-07-2001, 11:05 AM
I found the problem. Basically, I coded it stupid a year ago. Now it should be much improved (purely changes to the CharSprite class).

Regards,
-<font color=purple>The Hand</font color=purple>

<font color=green>All your code are belong to us...</font color=green> images/icons/tongue.gif

Teric
09-07-2001, 11:33 AM
Hm... I still don't see any little guy walking around. I'll play with your code a bit, see if I can get it to work.

Teric
09-07-2001, 11:42 AM
Ok, I stepped through your code, and found the following:

In the sub drawAniOnDC in your CharSprite class, you make the following function call:

tempBmp = SelectObject(aSpriteDC, mPics(aKey))
If Err.Number &lt;&gt; 0 Then Exit Sub

That Err.Number comes out as 5 on my machine, and it translates to 'Invalid procedure call or argument'. It looks like the 'SelectObject' function is not declared somewhere or I don't have the right references to it. I saw that you declared the 'SelectObject' reference above in your class code. Hm... if it's part of the gdi32, I should have it--I've got the Gdi32.dll in my WinNT/System32 directory. Hm... maybe the WinNT Gdi32.dll is different from the one found on Win95/Win98?...

Any suggestions?

Garrett Sever
09-07-2001, 12:32 PM
Perhaps there is an error that is just hanging around... try the following and see if it works:

Err.Clear
DoEvents
aSpriteDC = CreateCompatibleDC(aDC)
tempBmp = SelectObject(aSpriteDC, mPics(aKey))
If Err.Number <> 0 Then Exit Sub

The other possibility is that the images are not being loaded due to a path problem, but that shouldn't be the case. Check to make sure that there are actually 4 items in the mPics collection. Perhaps you unzipped ALL the files to one directory w/o the Sprites subdirectory?

Is anyone else having this problem?

Regards,
-<font color=purple>The Hand</font color=purple>

<font color=green>All your code are belong to us...</font color=green> images/icons/tongue.gif

Teric
09-07-2001, 02:28 PM
DOH!!! Yep, that was it, I unzipped all files to the same directory. I unzipped it again, this time allowing for subdirectories, and it worked just fine. (Konks head) I could've had a V8!

Thanks for the demo. I'll look through it for some ideas. :-)

Garrett Sever
09-09-2001, 09:28 AM
Just in case you all want more examples, I ran across two demos here (http://run-fast.to/download.php?op=viewdownload&cid=10&min=10&orderby=titleA&show=10) when we were browsing the Extreme VB beta site. I think my example is probably more flexible, however you may want to take a look anyways.

Regards,
-<font color=purple>The Hand</font color=purple>

<font color=green>All your code are belong to us...</font color=green> images/icons/tongue.gif

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum