Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2012

    XNA "idle" animation (Specifically to the side scroller project)

    Hey Guys,

    I just wanted to see if anyone had some direction of where I should be looking. I know that the side scroller project was written using 3.1 and I've enjoyed researching and updating with the 4.0 changes however I've gotten to the Idle animation video and have followed with the exact code, however the "animation" is speeding through animations and sometime drawing two sprites at a time in the draw area.

    I had played with xna during the 3.1 period a while back and had sprites animating at one point but this I'm not exactly sure why I'm getting this outcome. Did anyone else have this issue or have an idea of what might be going on? I've played with the width definitions of the supplied sprite sheet but it doesn't seem to be the issue.

  2. #2
    Join Date
    Mar 2005
    Sydney, Australia
    It's something in your code, the changes from 3.1 to 4 will not have affected the drawRects in anyway.
    If it's not following the framerate correctly, then somewhere you are causing a double-increase to frameTimeRemaining.

    Set a breakpoint at the beginning of your Update method, then step through it to find where it's happening.
    I sometimes find all references of a variable and set breakpoints on them all - then put a breakpoint on the first line of Update(), finally I can press Run and now I'm stepping to all the places the variable is. Takes time to set them all, but a handy way of tracking down when your absolutely stuck.

  3. #3
    Join Date
    Nov 2009
    I have a question about the video on the Idle Animation. Here is my problem I have gotten through the video and everything looks goods but I have an error at this point in the code:


    public virtual void Draw(SpriteBatch SB)
    SB.Draw(................................., new Color(Color.White, SHADOW_OPACITY)


    Apparently in XNA 4.0 Colors constructor does not take two arguments. Does anyone know how to fix this problem?

  4. #4
    Join Date
    Aug 2011
    Is SHADOW_OPACITY a float? Like the alpha value? You could simply do:

    new Color(Color.White.r, Color.White.g, Color.White.b, SHADOW_OPACITY) (or you could just put in values for r, g b yourself)

  5. #5
    Join Date
    Nov 2009
    Thank you so much, it works great now.

  6. #6
    Join Date
    Mar 2011
    Just wanted to jump inn and give you this link:

    Its basically a cheat sheet to solve many problems when going from 3.1 to 4.0 XNA =)
    in case it helps you or any other user who sees this post when searching similar problems

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