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! / Uhh....sprite is not working quite right

Author
Message
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 15th Jul 2003 05:31
[b]Ok hey everyone. It's me again. Just have a small issue with my 2d sprite. Using DarkBasic Classic, I put in the following code with me drawn as Superboy and for some reason 3 Superboys pop on the screen. The 2 are in the top left corner and the other on the bottom right corner and the one in the middle that moves actually moves but he's supposed to walk but it doesn't. He actually just slides to the right and when you go left, his leg lifts up and he walks but it's just to fast and while he walks, he turns around and looks right but still goes left. Any help with this will really appreciated and I promise to help you in the future if you reply. Well thanks
SuperCort2003
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 15th Jul 2003 05:35
Oh yeah. Hey another question. My hero is surrounded by a white box. How do I get that off?
Thanks for the replies. SuperCort2003
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 15th Jul 2003 19:28
for some reason 3 Superboys pop on the screen.

This bit of code is what makes 3 sprites:

sprite 1, heroX, heroY, herostance+(heroface*3)
sprite 2, 0, 0, otherheros
sprite 3, 600, 400, otherheros+3

0,0 is top-left (sprite2) - 600,400 is bottom right (sprite 3)
I not quite understand why you made 3 sprites if you only want one.


Now the walking - you only have a stand picture and a single walk picture - is this what you want? If yes try this:

I think you may want to give your sprite 4 or 5 frames of animation when walking to make it all look smoother.
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 15th Jul 2003 20:02
Hey thanks Flashingblade! I owe you. Hey that heroface*3 is quite obvious why 3 were up but uhh....thanks..now would you happen to know how to make my 2d character walk on bitmap background? Where in the code you just gave me would I put it in?
Moggie100
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location: Behind You...
Posted: 15th Jul 2003 23:40
In regard to the white area surrounding the character if you have drawn the character on a white background, DB/P will draw the sprite with the white area surrounding it - try filling in the white area with black, because black is not drawn on a sprite (is transparent) so no more white area - hope that helps

Mog

Rhaythe
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location:
Posted: 16th Jul 2003 00:25
Kind of a related question. If black is drwan as transparent what should you do if you want a primarily black sprite but still don't want to have the extra square area around it?

Thanks

SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 16th Jul 2003 00:46
Hey Rhaythe! That's a good question. See I'm starting a game starring myself as Superboy (please no applause j/k). Anyway I just outline his hair with a color that would outline his black hair but that's just what I'm doing. Don't do this idea becuz it's not the right answer to your question but is just what I'm doing.
Later
SuperCort2003
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Jul 2003 02:04
There are lots of colors that show up as black!

0,0,0
0,1,0
1,1,0

up to about

5,5,5

Just use higher numbers for black.

Use 0,0,0 for transparent.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Jul 2003 02:29
Alternatively, you can create your sprite using a format that supports alpha (like PNG and TGA)

If you must use bitmaps or jpg's though, you can use SET IMAGE COLORKEY to change the transparent colour.
ReD_eYe
20
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 16th Jul 2003 18:21
only in pro though ianm he's using classic
use:
set sprite spritenumber,0,1

to stop black being transparent

***Dbpro has arrived!!!!***
It arrived on the 15th(am) after being oredered on the 12th(pm) kudos to amazon!!!
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 16th Jul 2003 20:34
OK got another sprite problem. This time I have 6 frames for left and right but the problem is in my code. You see my sprite only walks left with 2 frames and when you try to go back, the character keeps looking left and walks left with frames 3-6 but is going to the right. What's wrong with my code?
Thanks for the replies.
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 16th Jul 2003 21:05
Hey guys! I fixed the problem with the left side and it works great. Now it's only the right side. It works fine except while I go right, he keeps flipping left and right. Could you show me what to change in my code? Thanks.

Login to post a reply

Server time is: 2024-02-26 12:11:19
Your offset time is: 2024-02-26 12:11:19