It is currently Wed Jun 19, 2013 6:20 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: the Z axis for the sprites ?
PostPosted: Tue May 26, 2009 2:42 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Oct 31, 2004 10:54 am
Posts: 511
I know the first sprite is displayed the most profound, however an option in displaysprite will be a better

example :


DisplaySprite(#eraser ,0,0,[depth ])

the parameter 'depth ' is the Z depth display

Style:

DisplaySprite (#eraser, 0,0,0)
DisplaySprite (#ball, 0,0,2)

#eraser is behind #ball!


be optional as it could keep the current system
with
DisplaySprite (#eraser, 0.0)



it is my idea good? :lol:

_________________
Image
************************************
site : http://michel.dobro.free.fr/
Videos : http://www.youtube.com/user/DobroMG
************************************


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 2:53 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Oct 15, 2006 8:56 pm
Posts: 1040
Location: Germany
I think it would be better to call it "z-order", not "z-axis". Axis is related with the 3D lib.

I would like to improve your syntax. Here is my

suggestion #1
Code:
DisplaySprite(SpriteID, x, y[, z-order])
Whereas z-order goes from -infinity to +infinity:
0 is the default, -1 is behind the default layer, +4 is in front of the default layer.

To keep the commandset compatible with future versions, here is my
suggestion #2
Code:
DisplaySprite(#eraser, 0, 0)
DisplaySprite(#ball, 0, 0)

SetSpriteOrder(#eraser, -1)
SetSpriteOrder(#ball, 0)

FlipBuffers()
#eraser is behind #ball!

_________________
PB 4.30
Code:
onErrorGoto(?Fred)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 3:11 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Oct 31, 2004 10:54 am
Posts: 511
yes , why not :)

_________________
Image
************************************
site : http://michel.dobro.free.fr/
Videos : http://www.youtube.com/user/DobroMG
************************************


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 3:15 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5184
Location: Germany
There are no "layers" for sprites. Thats why it is called 2D ;)

_________________
Perl – The only language that looks the same before and after RSA encryption.
-- Keith Bostic


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 3:25 pm 
Offline
New User
New User
User avatar

Joined: Tue May 26, 2009 3:17 pm
Posts: 9
Location: France
OK, no layers for sprites, but why not include it ?

cool would be management of 2 layer (Amiga playfield like), just to say sprite number "n" is top over all others sprites.

Imagine : easier way to make parallax scrollings, ability of a sprite to move alternatively front/behind another one or image (man walking like SOTB in a forest) !!!

Djes on French forum suggest to use linked list, maybe i'll use it


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 4:30 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Mar 19, 2006 1:57 pm
Posts: 4833
Location: Germany
it's a completely different approach.

Sprites are just Brushes.
they are no Objects wich have certain positions, you can display the same sprite x times every frame.

when you display a Sprite, the pixels of the Sprites are copied into the screenbuffer, overwriting those wich have been there before.

All Oldskool Mates: forget the Term Sprite!

they are Brushes! or call them Decals, if you like that better.


Quote:
Imagine : easier way to make parallax scrollings, ability of a sprite to move alternatively front/behind another one or image (man walking like SOTB in a forest) !!!

No, no, no!

this is a problem of YOUR Engine, how you write it, what you enable it to do and what not.

when you want a handling like that, create an appropriate object management.


so please, now all let's repeat in choir:

A Sprite is just a Brush!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 4:42 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Jul 21, 2006 4:41 am
Posts: 2300
Location: Berlin, Germany
I don't get it ...

What's the friggin' point of this? The sprites appear in the order you call them in your source code. Why on earth you would need an extra command for that?

_________________
Image
Windows 7, 64-Bit, PB v4.51 / Whose Hoff is it anyway?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 26, 2009 5:24 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 2853
Location: United Kingdom
If you need a Z order, just do it in software. Have an array of the sprite numbers you want to draw and the z order. Sort to the Z order then draw them in that order.

You could draw them if reverse Y order if you want them to appear with some kind of depth? Doesn't look good in some cases though.

_________________
http://www.SinisterSoft.com <- My Business website
http://www.ReportComplete.com and http://www.ReportPlus.co.uk <- School end of term reports system


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Exabot [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye