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.

DarkBASIC Professional Discussion / Help on pasting an animated sprite onto a 3D plane

Author
Message
Interplanetary Funk
16
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 6th Feb 2011 19:29
I'm messing around with sprites and planes in hope of a 2.5D effect. The problem I'm having is that the whole sprite isn't shown on the plane (just over a quarter is) and that I have no idea how to make the plane transparent where the sprite is. Also if possible, would I be able to remove the smoothing of the texture so you can see the sprite in it's pixelated glory

thanks in advance.

CODE:
#constant whiteCleric 2

sync on : sync rate 60
set image colorkey 255, 0, 255

create animated sprite whiteCleric, get dir$() + "\\white\\ClericWhite.bmp", 4, 4, whiteCleric

make object plane 1, 48, 48, 90

objCount = 1000

create bitmap 1, 24, 24
do
set current bitmap 1
sprite whiteCleric, 5000, 5000, whiteCleric
play sprite whiteCleric, 9, 12, 250

get image whiteCleric+objCount, 0, 0, 24, 24
texture object 1, whiteCleric+objCount
paste sprite whiteCleric, 0, 0
set current bitmap 0

sync
loop

P.S. Attached a copy of the sprite I'm using.

BASIC programmers never die, they GOSUB and don't RETURN.
soadjason
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location:
Posted: 6th Feb 2011 23:52 Edited at: 6th Feb 2011 23:53


Your sprite size is 24x32 but your code is 24x24. The cls clears the old sprite before drawing the new frame(you could see shadows of the other frames on your sprite). I also made the object proportionate to the sprite. I am not sure about the smoothing, however changing the object size did give it a better look in my opinion.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Feb 2011 13:55
Here's how I would probably do it. My game 'Backlash' uses a similar technique.

My Game due for release on AppUp very soon:
Backlash-Ninja Training

My Code for your sprite:


Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 8th Feb 2011 15:46
Wanna try again? Yep! -> Object already exists at line 2523
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Feb 2011 15:58
Quote: "Wanna try again? Yep! -> Object already exists at line 2523"

Sorry, which code does that come from?

Nothing posted here has that many lines

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 10th Feb 2011 15:32
baxslash, it would be faster to alter the vertexdata uv's instead of re-texturing. Also it's saves memory cause you don't have to split up the images.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Feb 2011 15:48
Quote: "baxslash, it would be faster to alter the vertexdata uv's instead of re-texturing. Also it's saves memory cause you don't have to split up the images."

You're probably right, I haven't done much with spritesheets before. The only example I've ever seen is from the explosion example given away in newsletter... 42 or something...

It used a slightly different method of splitting the image using memblocks but basically the same.

It might well be faster to alter vertexdata but I figure the method I posted was far simpler to understand (unless you could post an example of vertexdata manipulation that proves me wrong) and as for memory useage the images are 24x32 pixels each. Not really a problem here I don't think.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 10th Feb 2011 16:39 Edited at: 10th Feb 2011 16:43
Here's a quick example, though could be improved:



I can thank Van B for that little function there
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Feb 2011 16:54
That's neat! Quite simple too.

Thanks Sasuke, it's going in my snippets now!!

Login to post a reply

Server time is: 2026-07-16 00:08:06
Your offset time is: 2026-07-16 00:08:06