Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Apr 2003
    Posts
    4

    SpaceFighter Make Damage broken in 4.0

    I recently upgraded to XNA GS4.0 and ran into an issue. Once you run the game and cause damage to a sprite it does change color as designed however the transparency is lost so you see the entire frame rendered(forming a white square around this ships) which is of course a problem. Anyone run into this yet?

    Screenshot


    I just upgraded to 4.0 and VC# 2010 and things went fairly smoothly with the exception that the MakeDamageTexture method no longer works as expected. The compiler gives you one error, Textue2D overloads have changed, at least the one this method used. I removed the extra argument and changed the TextureUsage.None argument to a bool value, false. I'm not sure what the extra argument (1) was for as this machine does not have VC# 2008 on it and I haven't had a chance to try it on my other machine.

    Any help is appreciated. Thanks
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	damage.JPG 
Views:	284 
Size:	6.5 KB 
ID:	71050  
    Last edited by agustusx; 11-18-2010 at 09:58 PM. Reason: clarify a bit

  2. #2
    Join Date
    May 2006
    Location
    Toronto, Canada
    Posts
    36
    I've been having the same problem! It seems like Texture2D.GetData method isn't returning the alpha values properly. I've been spending the last few evenings searching teh internets for answers but to no avail. I was hoping to create a similar damage effect in the game I'm currently working on.

    I'll keep searching for a while and post here if I find anything.

    Cheers.

  3. #3
    Join Date
    Jun 2005
    Location
    Phoenix, Arizona
    Posts
    2,076
    Take a look at this link guys. I believe this should solve your problem. In XNA 4.0 the default way that alpha blending is handled has changed.

  4. #4
    Join Date
    May 2006
    Location
    Toronto, Canada
    Posts
    36
    That helped. One line change and it worked.
    Code:
    // spriteBatch.Begin();
    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
    Many thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •