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 / How do you animate sprites?

Author
Message
Tone Eternal
21
Years of Service
User Offline
Joined: 19th Apr 2003
Location: United States
Posted: 7th May 2003 01:58
I'm working on animating a few "baddies" in my space shooter. I'd like them to cycle between 2 frames to start, until I get the hang of it! hehe. Problem is I cant figure out how to designate frames, and then make 2 frames = 1 sprite. But I am not 100% on how to go about making these sprites animated. What is the most efficient way of creating animated sprites? Can I please get a little enlightenment?
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 7th May 2003 03:41
there is a animate sprite command.
I wrote an example of using it in the 2d section I think. a month or so ago.

CTP
Tone Eternal
21
Years of Service
User Offline
Joined: 19th Apr 2003
Location: United States
Posted: 7th May 2003 05:09
I saw a command for it.. create animated sprite I think. I tried to use it and I didnt see my sprite for some reason. I've made a simple game with inanimate sprites, but I dont know how to animate them.

So how do you do it? do you get sections of a bitmap? or do you load several images and set them as frames? and when you do set images(or sections of one image) as frames how do you set the speed? and how do you apply the actual animation? I dont mean to bombard with questions, but I can't seem to figure this one out..

any ideas?
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 7th May 2003 06:31
you have to use create animated sprite to set it
the activate it using play animated sprite
and you place it where you want it with the sprite command

try searching these forums there are examples of this and making your own animation function.
Tone Eternal
21
Years of Service
User Offline
Joined: 19th Apr 2003
Location: United States
Posted: 7th May 2003 06:47
I've been searching for a while now, and haven't had much luck. if there is a search engine it would help greatly.. Can anyone help me out? I'd really like to know how this is done.. broken down.

#1: What is the line of code that sets the frames?
#2: What is the line of code that plays back frames 1-x? Does it have to be forced to loop?

How is this done?


I think that I could make it cycle by setting the images for a sprite

sprite SprNumber,x,y,ImgNumber where ImgNumber changes every second to make it animate.. That is a way to do it.

But I dont think that its the RIGHT way to do it. and that there is a simpler way, someone please help me out.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 7th May 2003 10:32
i do it the way you do it by changing the image number,i use dbc but in pro i think's an animate sprite command or something similar.

ARE YOU A 3D MODELER??? IF SO WE NEED YOU!!!
EMAIL mynameisnoneofyourbuisness@hotmail.com to work on the new Star Strike project!!!
Tone Eternal
21
Years of Service
User Offline
Joined: 19th Apr 2003
Location: United States
Posted: 8th May 2003 03:36 Edited at: 8th May 2003 03:37
Ok I'm really trying to figure this out...
What am I doing wrong?

Forget about the Rem ***** load inanimate sprites part I forgot to change that, I dont have it organized properly due to trial and error going worse
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 8th May 2003 03:41
ok,
CREATE ANIMATED SPRITE Sprite Number, Filename, Across, Down, Image Number
where sprite number is a integer location for the sprite
filename is the name of the image file with the images all combined to one sheet
across is the number of rows you would like to have the sheet sliced to
down is the number of colum slices for the image sheet
image number is a number to hold the entire sheet

example
create animated sprite 1,"ship.bmp",4,4,1
this creates animated sprite 1 from the image file ship.bmp, cuts the sheet into 4 rows by 4 colums, and lastly stores the sheet in image number 1

PLAY SPRITE Sprite Number, Start Frame, End Frame, Delay Value
sprite number is the number of the animated sprite you created
start frame if the frame to animating(note it will cycle though the whole animation first even if you tell it to start on say frame 4), you can use set sprite frame to have it start on another frame value
end frame is the frame to start over after
delay is a value in millisec to cycle the animation


example using the 1st example
play sprite 1,1,16,100
note this does NOT show the sprite, it just starts the sprite cycling though images 1 though 16 because we cut the sheet into 16 pieces 4x4.

now just use the sprite command to show the sprite where you want it at

example using previous
sprite 1,screen width()/2, screen height()/2,1
this displays sprite 1 in the center of the screen
1 is the animated sprite number
screen width()/2 is the screen width cut in half
screen height()/2 is the screen height cut in half
and 1 is the image number of the sprite sheet

hope it helps

CTP
Tone Eternal
21
Years of Service
User Offline
Joined: 19th Apr 2003
Location: United States
Posted: 8th May 2003 13:37
Thanks a bunch! I greatly appreciate your help! I had misunderstood the CREATE ANIMATE SPRITE COMMAND.

Login to post a reply

Server time is: 2024-11-24 13:45:40
Your offset time is: 2024-11-24 13:45:40