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.

Newcomers DBPro Corner / Sprites...

Author
Message
Waffles
14
Years of Service
User Offline
Joined: 7th Mar 2010
Location:
Posted: 8th Mar 2010 02:36
Im super new to all of this, so can someone please explain to me (I have a picture with a bunch of "sprites" on it...) how can I make my screen display just one sprite from that page? Or better yet, how can I make it so that it displays one sprite from that page, then switches to another.

Animating sprites I guess is my question.
Probably best to answer as if you were talking to a six year old...

Waffles
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Mar 2010 15:22
Hello Waffles, welcome to the TGC forum.

The commands you need to look at are:
CREATE ANIMATED SPRITE Sprite Number, Filename, Across, Down, Image Number

PLAY SPRITE Sprite Number, Start Frame, End Frame, Delay Value

The images on the sprite sheet must be the same size. The CREATE ANIMATED SPRITE command will take the bitmap and dissect it, creating images that you can use to animate the sprite. PLAY SPRITE will play the specified images at the specified delay rate.

In case you don't know, you can access the help files for a particular command by typing it's name into the editor, making sure the cursor is on it and then pressing F1.

Hope this helps,

LB

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 8th Mar 2010 21:24
Hi Waffles!

Please be aware that many of the help files in DBPro are incorrect, and examples may not work.

For instance, the help for CREATE ANIMATED SPRITE shows



which is incorrect, and should be



and the help file example for PLAY SPRITE will not work as written, because it tries to use frame zero, which does not exist. It has other problems as well.

Once you have tried some of these commands, post any questions, with attached code, and the kind folks here will certainly help.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Mar 2010 03:50 Edited at: 9th Mar 2010 04:03
Quote: "The images on the sprite sheet must be the same size."


Or more precisely... 'the images on the sprite sheet must be the same size or (more importantly) at the least, equally placed on a grid where each grid cell is the same size'.

For example, if the Across and Down parameters were 5 and 5 then the sprite sheet would be cut up equally into 25 rectangles (the size based on the width and height of the image divided by 5).

If the images aren't equally spaced on an imaginary 5x5 grid, they won't be in the same position of each cell in the resulting sprite.

Finally, I wouldn't be doing my job right if I didn't point you here:

http://forum.thegamecreators.com/?m=forum_view&t=164981&b=4&p=0

But, in my defence, it does have an example sprite sheet image showing how the images have to be correctly spaced on a sprite sheet before it will work

TDK

Waffles
14
Years of Service
User Offline
Joined: 7th Mar 2010
Location:
Posted: 10th Mar 2010 03:26
Thanks everyone!

Waffles
Waffles
14
Years of Service
User Offline
Joined: 7th Mar 2010
Location:
Posted: 10th Mar 2010 04:15
mkay... I messed around with creating animated sprites, I even got a spreadsheet of well-placed sprites online. Its 18x3 sprites. It looks good it compiles fine, but its just a blank screen...



Waffles
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 10th Mar 2010 17:21
You should declare a sync rate. Also, you should number your sprites starting at 1. This should work for you:



This code displays the number of the current frame of animation. It also disables the ESC key, but checks for it manually, so that you can delete your media before exiting.

Login to post a reply

Server time is: 2024-11-24 20:52:43
Your offset time is: 2024-11-24 20:52:43