Sprite draw order issue

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Sir Robin
Posts: 392
Joined: Wed Dec 22, 2021 7:02 pm
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Sprite draw order issue

Post by Sir Robin »

I'm creating this actor object that when it's over a gap, instead of falling it spawns a fake bridge sprite to stand on. It's not a floater, if knocked off it's bridge it will fall, but it spawns the bridge to try not to. Think of it like a bridge layer or a magic carpet carrier.
Everything is working as it should but the bridge is drawn over the actor instead of under/behind. See this image:
Spoiler:
The chaingun guy represents the actor and the actor-missing sprite represents the bridge (stand-ins until I get my real graphics done).
Notice the CGG looks like it's standing behind the bridge, but in fact that are both centered over the vent.
When seen from below it's drawn proper, but I think that's just the 50/50 chance.
Spoiler:
What's the way to get this drawn properly? Can I do this with a sprite or should I be using a 3d-model?
User avatar
SanyaWaffles
Posts: 764
Joined: Thu Apr 25, 2013 12:21 pm
Discord: SanyaWaffles#0950
Twitch ID: sanyawaffles
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support
Location: Disappointment Island

Re: Sprite draw order issue

Post by SanyaWaffles »

Flatsprites have always been kind of messy and don't really work properly due to a bad implementation or something. You're best using 3D models that are just flat until (if ever) the engine is fixed.
User avatar
Sir Robin
Posts: 392
Joined: Wed Dec 22, 2021 7:02 pm
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Sprite draw order issue

Post by Sir Robin »

What's the quickest easiest way to do that? I'm searching for tutorials but finding stuff that assumes I already have models created and want to import them. Any idea how to just open an editor, draw a 64x64 square, apply a texture, and save it?

And here's another weird thing I found about flat sprites - the x-orientation is backwards. (0,0) is the top-right, not the top-left.
User avatar
Sir Robin
Posts: 392
Joined: Wed Dec 22, 2021 7:02 pm
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Sprite draw order issue

Post by Sir Robin »

Okay, managed to replace it with a 3d model. I used the cube from Nash's Radius Debug project, and just scaled it to the size I needed - 64x64x1

The code looks like this:

Code: Select all

Model FakeFloor
{
	Path "models/block"
	Model 0 "Block.md3"
	Skin 0 "FakeFloor.png"
	Scale 0.64 0.64 0.1
	ZOffset 0.01
	AngleOffset 90
	FrameIndex 0000 A 0 0
}

Return to “Scripting”