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.

2D All the way! / Animations Help ?? Im a newbie on DB

Author
Message
KaiProton
12
Years of Service
User Offline
Joined: 5th Aug 2010
Location: Manchester, UK
Posted: 8th Aug 2010 13:03
Hi,
Im trying to learn DBP and started with 2D, my overall idea is a top view Alien Breed type game, but I cant run before walking, so Ive started trying to learn animations,
Please check out my code:

Im using the pac man Image from the tutorial on this site..

the frames are :
12
34
56
78

I think this is how DB reads the image, so Moving right is 1,2 and the moving left is 5,6, but when I move right, then left, the anim loops through 3,4,

anyone know what Ive dont wrong ?

Attachments

Login to view attachments
LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 9th Aug 2010 07:00 Edited at: 9th Aug 2010 07:01
I think that there is something wrong with your pac-man image. Try this one and see if it works for you. Also, I made a couple of edits to your code. My experience with PLAY SPRITE is that it will play through a series of frames to get to the ones you want when you change directions.



Also, it is best to have the SYNC at the end of your loop, so that it redraws things correctly.

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

Attachments

Login to view attachments
KaiProton
12
Years of Service
User Offline
Joined: 5th Aug 2010
Location: Manchester, UK
Posted: 9th Aug 2010 09:43
Thanks LBFN, that worked brilliantly,

I found, after posting, the set sprite command, and I did try to impliment it, but with no success, I guess it was because I had the frames checked outside the keypress if's

also I did notice you rem'd out my And on each keypress line,
Was there a reason for this?
the reason they are there is to stop the player from MOONWALKING the character..

Thanks again
LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 9th Aug 2010 17:24
Quote: "I found, after posting, the set sprite command, and I did try to impliment it, but with no success, I guess it was because I had the frames checked outside the keypress if's"


I assume you are using SET SPRITE to try to eliminate the black that is showing in the image. If you convert the image to a .bmp file, it should work fine. I have not been able to get SET SPRITE to work with .pngs to eliminate the black background. Using SET IMAGE COLORKEY doesn't seem to help either, as it works with .bmps from my experience.

Quote: "also I did notice you rem'd out my And on each keypress line,
Was there a reason for this?"


uhhh.....no, they were remmed out in the code you posted.

So many games to code.......so little time.
Grog Grueslayer
Valued Member
17
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Aug 2010 08:07 Edited at: 10th Aug 2010 08:12
Quote: "I assume you are using SET SPRITE to try to eliminate the black that is showing in the image. If you convert the image to a .bmp file, it should work fine. I have not been able to get SET SPRITE to work with .pngs to eliminate the black background. Using SET IMAGE COLORKEY doesn't seem to help either, as it works with .bmps from my experience. "


It's probably because .pngs are designed to use a transparent background so there's no need to use either of those commands if you get rid of the black background with a drawing program (see attached .png).

I just used this code in another message:


Attachments

Login to view attachments

Login to post a reply

Server time is: 2022-12-06 10:19:03
Your offset time is: 2022-12-06 10:19:03