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 / Cannot get my sprite to play.

Author
Message
Auric25
12
Years of Service
User Offline
Joined: 28th Aug 2012
Location:
Posted: 28th Aug 2012 23:24
Hello everybody, how are you?

I have a piece of code that i nabbed from the forum to play a sprite animation as a test for sprite sheets. So, it comes up just fine if you only enjoy a blue screen :/ Is there something I am doing wrong with the image grabbing?

Here is the code in question




thank you very much for your time. I'll include the file as well.

Ask me anything.

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 29th Aug 2012 18:41
Hello,

You are waiting 4 seconds before you update the animation frame. Change the last number in the play sprite command from 4000 to 100 and it should work fine.

So many games to code.......so little time.

Auric25
12
Years of Service
User Offline
Joined: 28th Aug 2012
Location:
Posted: 29th Aug 2012 21:40
Hi LBFN, I have made the change you suggested but I am still getting a blue screen. Is there anything else you can think i am doing incorrectly? I have the file in the same folder as the project too. I'm a little lost to be honest.

Ask me anything.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2012 03:33 Edited at: 30th Aug 2012 08:44
That's odd. I ran the program and the sprite animated fine. The blue screen was in the background, but the sprite showed up.

You might try the DRAW SPRITES LAST command. Place it in the code before the DO - LOOP.

EDIT: I ran the code again and it works fine. I know you said the image was in the same folder as the program file, but the fact that it is not showing up makes me wonder.

Please don't be insulted by my asking this. You will have a file that has a .dbpro extension and one with a .dba extension (whatever name you saved the files under). The "hairy guard.bmp" file is in the same folder as these two files, right?


So many games to code.......so little time.

leo877
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 31st Aug 2012 02:25 Edited at: 31st Aug 2012 02:33
@Auric25

Hello. Its been a while sinse I use DBpro, but from what post are trying to get rid of the blue when you trying to animate. There acommand in DBP were you set transparent color thto the background it you sprite. heres the command

were the zero are enter the value of that blue background.

Make sure this command is used at the begin of the code, on top of the line create animated sprite.

i think the value to use is 133,135,255

the first 133 is for red value 135 is grren value and 255 is blue.

did you make this strip or dl from some were else.


Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 1st Sep 2012 00:16
As Lucas pointed out, your file is in a png format (even though the extension is .bmp). This shouldn't really make a difference (except that Set Image Colorkey won't work) though as I think DBP doesn't look at the extension and determines the file format by reading it.

Which version of DBP are you using?

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 2nd Sep 2012 00:13
It works fine on my machine... The only difference was I stuck the image in my root and used an absolute path "C:\hairy guard.bmp" (btw, note there's no trailing space after filename).

Btw: Hodgey and Lucas are right. That is a PNG file. Bytes 2 - 4 are 'P', 'N', 'G'. But then it could be a conspiracy too.

SIDENOTE
It seems DBPro reads the file's header and not just the extension. That's quite a relief.
/SIDENOTE

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 2nd Sep 2012 12:13
Quote: "It seems DBPro reads the file's header and not just the extension. That's quite a relief."

I haven't tried with DBP but in AppGameKit you can rename .pngs to anything you like and AppGameKit will still load them correctly; which can make it handy if you want protect your assets. I changed the name of some images to .dll

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 2nd Sep 2012 20:38
Quote: " I changed the name of some images to .dll "

I never bothered protecting my assets (I figured users could just screen cap any images they wanted to). Then when I started working on that 2 year on/off project, I actually realised asset protection was also important to stop people modifying the game. The system I use now is top-secret atm but I can tell you it involves aliens, hamsters and a tomato. The tomato is very important.

Login to post a reply

Server time is: 2024-11-23 17:47:46
Your offset time is: 2024-11-23 17:47:46