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 / render staff only when are passing a "mask" pure 2d sprites

Author
Message
lms
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location:
Posted: 7th Jul 2010 22:46 Edited at: 7th Jul 2010 23:00
hi i am using sprites and know good enough the priorities and paste sprite and etc
i am confused on how to make this >

i want to have a sprite 100*100 at 10,10 (box)
and i have 40 sprites vertical alligment that scrolls down behind this box and i want to use this box as "a mask" to say i want to see the 40 sprites that moves down but only "the viewable space" when they pass in front of the box

thanks in advance
just uploded a photo

all os break
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jul 2010 22:54
You want a 'window' of 100x100 and sprites to only appear within that window?

Sounds like SET SPRITE VIEW from my plug-in set.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Jul 2010 18:15
Would that stop other sprites being visible elsewhere in the screen?

Would it be possible to have another sprite filling the whole screen but with a transparent hole in it? If so then you can set the sprite priorities so that the right sprites show - and you can have a fancy shaped hole as well.
Alfa x
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 9th Jul 2010 18:28
Myabe you can do a code that make the sprite invisible until it collides with the viewable space. And make the viewable space with transparencies that allow to see only the parts you need.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Jul 2010 18:58
Here's an example of the sort of thing I mean.
lms
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location:
Posted: 9th Jul 2010 19:25 Edited at: 9th Jul 2010 19:51
thanks for any help ill try to explain it better this time

see photo first pls

priorities cant work with this
also tricks with paste first this and the this alos doesnt work cause the height of 3 sprites + spaces is bigger than a gap
i also tried with first paste gap2 sprites get image it and then all the rest and paste again gap2 at end.IT WORKS BUT ITS TO SLOW..(get image) so i forget it as i need 6 more gaps
i havent tried sprite collision CAN i say if "sprites a" collides with gap1 the collided pixels only to be rended same for gap same for gap3. will this be fast i need 6 more gaps total 500sprites/9gaps?
can i setup in 2d 3cameras and say this camera is this box and only sprites 1 to 30 will be shown throw here same for 6 cameras more and also a png transparent on top of all with the 9 holes for the cameras?
any ideas?
thanks in advance

all os break
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jul 2010 22:40
Quote: "Would that stop other sprites being visible elsewhere in the screen?"

Yes, it works just like when you set the camera view.

If you want selected sprites to appear within a view, and other selected sprites to appear outside that view, then you need to get a little creative:

1. Clear the sprite view
2. Render all sprites outside the sprite view
3. Set the sprite view
4. Sync

If you want multiple views then simply set each view in turn and render all sprites for each of those views.

Or, again set the sprite view and have a sprite that has a higher priority than all other sprites that recreates the 'gaps' after they have been destroyed by the other sprites - similar to GG's example in fact.

tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 9th Jul 2010 23:01
IanM- does sprite view also work with paste sprite?

I have a similar thing I need to do and what was suggested to me was modifying the UV coord of the sprite I was using. But if I can do several sprite view sections before the sync this would be perfect.


A 3D marble platformer using Newton physics.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Jul 2010 23:15
Oops, my bad.

Sprite views are only active during SYNC - I remember now making a big effort to ensure that the views only affected sprites and not any other rendering operation (BOX, LINE, PASTE IMAGE etc).

GIDustin
18
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 10th Jul 2010 07:22
IanM! We meet again

So in the D3D_Func thread I added those viewport commands, and this is the exact type of thing I made them for:



lms
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location:
Posted: 11th Jul 2010 16:36
thanks problem solved nice adds btw exactly what i need
d3d_setviewport
d3d_resetviewport

all os break

Login to post a reply

Server time is: 2026-07-25 08:13:11
Your offset time is: 2026-07-25 08:13:11