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 / i simply want to animate a sprite but can't

Author
Message
Matt Kitcat
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 27th Oct 2003 17:05
Ok. I have been at this for hours but have got nowhere. can someone show me the very simplest of ways to animate a sprite. I have been trying to use the help/examples/sprite in DBpro. Once I have got it working I will then use my own image for a particular purpose but being totally new I cannot decipher any of the examples. The play sprite command usage example doesn't even include the play sprite command which is frustrating!

create animated sprite 1, "animspr.bmp", 4, 4, 16

sprite 1, 0, 0, 16

play sprite 1, 1, 16, 60

wait key


I seem to have completely failed to understand what should be a simple thing to acheive and I can find no information for this. can anybody kindly help me?
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 27th Oct 2003 17:46
replace wait key with

do
if spacekey()=1 then end
loop

maybe the wait key is freezing your program?

-RUST-
Matt Kitcat
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 29th Oct 2003 02:12
For newbies like me it is really hard wading through the non help that comes with dark basic. The code above merely shows the bitmap. I have looked at the help/examples/sprite example but it doesn't actually show any of the sprite commands in simple terms. I am thinking I have wasted my money. there appears to be very little coherent information. I have downloaded the tutorials but they don't run, some sort of syntax error. It is a bit of a shame because you download the demo, are persuaded that dark basic is really easy and that there are loads of examples and help but they don't include the examples in the demo so you can't establish that the examples don't actually demonstrate the commands. I don't want to gripe but I have been tearing my hair out trying to get a simple animation from the example supplied with the sfotware I paid for. It is very telling to me that the usage example for "play sprite command" doesn't actually include the command "play sprite" Does anybody actually know anything about sprite animation or where I can get information? I'm starting to tear my hair out :-(. Can somebody show me some code (that works) that will simply put the animated asteroid sprite that comes with dark basic in the middle of the screen animating like I imagine it is supposed to? If I can get that to work I can find out if this software is going to be the right thing for me.

Thanks
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 29th Oct 2003 03:00
ok, first off, stop pulling out your hair - trust me!
secondly, I am pretty sure (but others here should chime in) that in order to animate a sprite you need to supply db with the images that will make up the animation. GET those IMAGES, once you have them, make the a sprite, then play the sprite. I may be wrong or not explaining it correctly as I haven't done really any 2d stuff but the concept is the same as cartoons - a series of images shown over one another to mimic movement-

Don't be disuaded or put off of db -the help system sucks and the people who wrote it-know it. There are plenty of people here making awesome games - take it slow, give it a chance - this thread will take off, watch....

<BUMP>

-RUST-
Guyon
21
Years of Service
User Offline
Joined: 6th Jun 2003
Location: United States
Posted: 29th Oct 2003 05:38
Have a look in the Bug forum - there *are* problems with animated sprite, but you'll also see all the information you need to get it working for you there.
Matt Kitcat
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 29th Oct 2003 14:05
OK Thanks for your calming words of support. I have got the bitmap from the sprite example on the DB CD. The sprite is an asteroid and there are 16 images which the create animated sprite command is supposed to split up and play. It works in the demo but there is a load of cloning going on that I don't want right now. I want to get the asteroid in the middle of the screen rotating. Once I have done that I will start to create my own image to see if it is going to help with my Pyro display.
If you are in the UK and can make it to the Alton Towers halloween spectacular you will see my crazy flame system. I am trying to create a way of visualising it and was recomended DB as a place to start.
I will start tra\wling through the bug section but if anybody knows a bit about animated sprites I would love to hear from them./

Cheers.
Slightly happier now
Matt
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 29th Oct 2003 23:50
`try this hope it help



sync on

`..............make ten sprites..............
for a=1 to 10
box 120-a*2,120-a*2,120+a*2,120+a*2

`..............grab the sprite...............
get image a,120-a*2,120-a*2,120+a*2,120+a*2

next a
cls

do
`.........................Speed of sprite move right........
if move=0 then sx=sx+3

`.........................Speed of sprite move left........
if move=1 then sx=sx-3

`.........................Turn the sprite at end of screen.....
if sx> bitmap width() then move=1

`.........................Turn the sprite at start of screen....
if sx<1 then move=0

`.........................if sprite image grater than 10 then start at 0
if i>10 then i=0

`..........................get next next Sprite Image........................
i=i+1

`.........................show Sprite
sprite 1,sx,120,i

sync
loop

You cant do it if you try
Matt Kitcat
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 30th Oct 2003 16:29
Thanks for replying.
I could'nt get it to work. Command out of place at line ten (next a.
I am trying to acheive what I thought would be one of the most simple things in the world. I want to animate the animspr.bmp in the middle of the screen. The bitmap is in the help/examples/srite folder.
As far as I can see this should animate the srite according to my understanding of the help files:


sync on : sync rate 0 : backdrop on : color backdrop 0
rem Load images
set image colorkey 255,0,255
create animated sprite 1, "animspr.bmp", 4, 4, 16

rem Setup asteroid sprite
sprite 1,320,240,16 : size sprite 1,128,128 : offset sprite 1,64,64

play sprite 1,1,16,50

sync

But it simply places the whole bitmap in the middle of the screen.

Am I going mad?
Matt Kitcat
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 30th Oct 2003 16:44
Ha!


set image colorkey 255,0,255

Create Animated Sprite 1,"animspr.bmp",4, 4, 16

size sprite 1, 100, 100
Sprite 1,300,240,1

Repeat

Play Sprite 1,1,16,10

Until Mouseclick()=1


This is it. I think I get it now.

Login to post a reply

Server time is: 2024-09-21 07:30:49
Your offset time is: 2024-09-21 07:30:49