Sounds and Sprites
I still am wondering how to make the portion of sprites that are behind things disappear and also how do I do 3d sound? You know when things to your right and far away sound soft and come from your right speaker or headphone.
first problem: z-buffering
2nd problem: directsound3d
2nd problem: directsound3d
||--------------------------||Black Hole Productionshttp://bhp.nydus.netResident expert on stuffmax621@barrysworld.com||--------------------------||
You should enable depth testing to solve your first problem (are you working in 2D or 3D?). As for your second problem, you might want to check out OpenAL (www.openal.org) if you want better compatibility across platforms.
Morgan
Morgan
How do you enable z-buffering? And also if you turn depthtesting on the sprites cover each other up. Anybody know how to fix this?
To get your sprites that are behind things to disappear you need to do this:
you need to draw in the reverse order that they should appear in.
Example:
your character is walking along the screen and then walkings behind a tree. You need to draw in this order: background, character, then tree. This will draw the tree over top of the character making and part of the character behind the tree to disappear
you need to draw in the reverse order that they should appear in.
Example:
your character is walking along the screen and then walkings behind a tree. You need to draw in this order: background, character, then tree. This will draw the tree over top of the character making and part of the character behind the tree to disappear
In my 2d games I use layerings instead of ZBuffer.
Simply create layers like that :
(farthest)
ground
objects
characters
tres...
(nearest)
Just draw from the farthest to the closest layer and you''ll get everything displayed in the correct order :o)
Hope it helps.
-* Sounds, music and story makes the difference between good and great games *-
Simply create layers like that :
(farthest)
ground
objects
characters
tres...
(nearest)
Just draw from the farthest to the closest layer and you''ll get everything displayed in the correct order :o)
Hope it helps.
-* Sounds, music and story makes the difference between good and great games *-
If you are working on a 3d world using a perspective projection, just enable z-buffering (depth test) and all the stuff about what is far and what is near will be menaged automaticcaly by the hardware just specifyng different z coordinates for your 3d object. If you are working on 2d I really don''t know how to help you. For 3d sound I found on the net a lot of examples of directsound3d (the code is in VB but if you use VC I think it''s not difficult to translate it). E mail me if you want some vb examples code about directsound3d at tripuno@tiscalinet.it
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement