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 / Help with playing sprites for a 2d game please

Author
Message
Horadrim
15
Years of Service
User Offline
Joined: 22nd Jul 2009
Location:
Posted: 23rd Jul 2009 01:33
I need a bit of help with playing sprites. I've got a simple figure with only 2 frames (one of him standing, one of him punching) and I'm using dbPlaySprite(5, 1, 2, 50); and this is where I'm having trouble. I've tried dbPlaySprite(5, 2, 1, 50); or dbSetSpriteFrame(5, 1,) or any combination there of. Even tried to set it to the second frame, dbWait(50), set it to the second frame. And none of it works. Finally, I went back and just changed the character frames so that the punching frame was sandwiched by two frames of him standing there so I could do dbPlaySprite(5, 1, 3, 50); but that seems to kind of act weird and if I lightly tap the space bar my character will get stuck in the second frame, just leaving his fist out there and not going to the 3rd frame. This is obviously my first time using this GDK so any help would be much appreciated, sorry for the massive block of text.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 23rd Jul 2009 04:23
The Dark Invaders tutorial that comes with DarkGDK uses animated sprites among other things and is a complete "space invaders" style game tutorial, where you will create, basically, a compelte game.

You can find the tutorial in PDF form in the DarkGDK tutorials folder, or you can look at the DarkGDK forum stickies and get a link to same tutorial presented as a short video series, which offers much better explanation for a beginner than the straight PDF tutorial.

For animated sprites specifically though, you need to call some commands to set them up properly, either the Dark Invaders tutorial(for game usage of animated sprites) or the "DarkGDK Beginners" tutorial(which shows you the basics of how to setup a simple animated sprite of the earth and set it rotating) would be the place to look.

As a last option, if you cant get any satisfaction or what you are after from the tutorials(which assume a moderate knowledge of c++ in regards to program structure and data usage etc) searching through these forums might land you a user written tutorial or some useful hints and tips.

If it ain't broke.... DONT FIX IT !!!
Horadrim
15
Years of Service
User Offline
Joined: 22nd Jul 2009
Location:
Posted: 23rd Jul 2009 04:50
Yeah, I looked at the space invaders game and followed the model that they used for most things, just doesn't seem to me moving as smoothly as their animations are. I'll take another look at it and look at the other documentation that you suggested. I've got a very good knowledge of c++, just on day 2 of us this gdk. Thanks for the help!

Login to post a reply

Server time is: 2024-10-01 08:33:38
Your offset time is: 2024-10-01 08:33:38