Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Simple 2D question

Author
Message
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 23rd Dec 2007 03:17
Hi

I'm using VC++ 2008 and Dark GDK for some simple 2D animation.

I have a simple question.

My sprite is meant to talk as in the only difference between frames is the mouth opens and closes and the eyes blink. But when I run the code the sprite moves across the frame instead of standing in one place with just the mouth moving. The animation is clean and good without flicker but I don't want the sprite to slide across the frame. As it dissapears out the right side the next frame is already coming in the left.

Is this because I somehow don't have my sprites exactly positioned right in the *.jpg? I spent a whole day drawing a graph and exactly positioning the sprites the same distance apart. The only thing I'm unsure of is how does the GDK know where the exact centre of the first sprite should be anyway?

Here is the code:



As you can see it's nothing but the basic skeleton of the "Hello World" code but using my own sprite. Is there a tutorial anywhere on how the animation *.jpg file should be set up exactly? I just presumed that every frame must be EXACTLY the same distance from the last? And how many frames can be in a file? Is a *.jpg better than a *.bmp? etc

thanx

m0ng00se
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 23rd Dec 2007 11:52
I worked it out. You have to have the same number of frames down as across. I didn't realise that. Now it stays in one place sort of except yeah I'm a few pixels out on my sprite sheet and after nine versions it still jumps about.

Is there some easy way to get the sprite sheet perfectly lined up? I'm rendering my sprite in 3D Max, saving the image, moving it a fraction, rendering again, saving etc... 16 times. Then I cut and paste the sprites onto my sprite sheet in MS Paint but no matter what I do I can't seem to get them perfectly lined up. What does everybody else do? I've wasted two days just trying to get all my sprites lined up right on the sprite sheet.

I was thinking next time I might put a box around my sprite in 3D Max before I render it, then I just have to line up the box then paint it out later? This Dark GDK is pretty good though if only I could find some reference material on all the 2D functions and how to double buffer and write text to the screen. The only 2D tutorial for GDK seems to be the simple Hello World app and everything else is 3D stuff.

m0ng00se
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA

Login to post a reply

Server time is: 2024-09-29 07:34:06
Your offset time is: 2024-09-29 07:34:06