Hi everyone,
I've been learning some C#/XNA on my own and got a funny idea for a small game and I've decided to attempt it as a large learning exercise. I've already hit a road block just trying to create the starting menu. I really like to learn by doing so even though this is probably too advanced for me, I'd really like to just try to complete it.
Problem 1) I have a foreach loop that draws the floating symbols one by one, which somehow seems to mess up the draw order. As you can see, I have the drawing order set to BacktoFront. I figured putting the portrait and title at the end would put them on top, but it seems that some of the floating images pass in front and some go behind. I currently have the two still images written first just as a little test, which has the same issue. Why are some of the objects being drawn by the loop ending up drawn after the portrait and title?
Problem 2) the music seems to stop a few seconds in. This is definitely influenced by how many floatingBit objects I create during Initialize but I am not sure why. If these little moving images are taxing the computer so much, why would only the music stop and the program not crash?
http://pastebin.com/eBh7eKEZ
^ all my code is currently in here, sorry if it has poor readability etc. and let me know if there are any questions what I am trying to accomplish with certain code. a bunch of stuff I'm planning on using later is commented out.
http://www.mediafire...vd252sb36czkup0 (published demo)
Thanks, if anyone can help. Let me know if I haven't been specific enough.
2 Replies - 1164 Views - Last Post: 05 August 2012 - 03:13 PM
#1
Draw order problems and soundEffect (music) stops playing suddenly
Posted 31 July 2012 - 04:14 PM
Replies To: Draw order problems and soundEffect (music) stops playing suddenly
#2
Re: Draw order problems and soundEffect (music) stops playing suddenly
Posted 02 August 2012 - 06:43 PM
Hey, I guess I can't edit my posts? I would have just done that, but I can't find the link anywhere...the mediafire link above won't work now, use this one:
http://www.mediafire...5f4grd5x2zu3ow0
This is a newer version of the same thing. The only thing I changed was that I realized what I really wanted for the question marks was a sine wave type movement, so I set up a version of that.
Still have the same issues, really can't figure out either one. Shouldn't each iteration of the foreach loop take place before the draw command for the portrait if I put the portrait draw after the loop? And with back to front sort mode, all the question marks should be below the portrait. I'm kind of mystified as to why some would be above and some would be below.
Once again like I said I apologize is my code is sloppy or hard to read and let me know if there are any questions of what I'm trying to accomplish.
Whoops...and this was the slightly different code (the only thing I really changed so far was the movement described above)
http://pastebin.com/kV3hJ91f
http://www.mediafire...5f4grd5x2zu3ow0
This is a newer version of the same thing. The only thing I changed was that I realized what I really wanted for the question marks was a sine wave type movement, so I set up a version of that.
Still have the same issues, really can't figure out either one. Shouldn't each iteration of the foreach loop take place before the draw command for the portrait if I put the portrait draw after the loop? And with back to front sort mode, all the question marks should be below the portrait. I'm kind of mystified as to why some would be above and some would be below.
Once again like I said I apologize is my code is sloppy or hard to read and let me know if there are any questions of what I'm trying to accomplish.
Whoops...and this was the slightly different code (the only thing I really changed so far was the movement described above)
http://pastebin.com/kV3hJ91f
#3
Re: Draw order problems and soundEffect (music) stops playing suddenly
Posted 05 August 2012 - 03:13 PM
Okay, I got some help elsewhere: here's what two problems I had.
1) I didn't realize what BacktoFront meant, so once I was told that and changed it to Deferred and all is well.
2) the sound instance only existed inside of Initialize, so once that was gone, it disappeared.
1) I didn't realize what BacktoFront meant, so once I was told that and changed it to Deferred and all is well.
2) the sound instance only existed inside of Initialize, so once that was gone, it disappeared.
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote



|