Hellbroth's Profile User Rating: -----

Reputation: 17 Tradesman
Group:
Contributors
Active Posts:
191 (0.1 per day)
Joined:
15-August 09
Profile Views:
9,299
Last Active:
User is offline Apr 22 2014 01:50 PM
Currently:
Offline

Previous Fields

Country:
GR
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
100

Latest Visitors

Icon   Hellbroth has not set their status

Posts I've Made

  1. In Topic: How To Do 2D Animation On Xna : Part 1

    Posted 22 Apr 2014

    View PostSoyaku, on 27 October 2010 - 01:42 PM, said:

    Question: How would one reset the index of currentFrame.X back to 0 during this type of animation? I should be able to figure it out, but I'm still getting used to the game loop concept and have ran into problems. If you don't reset the index back to 0, it will skip frames and make animation with fewer frames show a blink-like effect. (Due to there not being a sprite in said slot.)

    Code:
                    //Walk Backward
                    if (currentState.IsKeyDown(Keys.Left) || currentState2.IsConnected && currentState2.DPad.Left == ButtonState.Pressed)
                    {
                        mCurrentState = State.WalkingLeft;
    
                        if (mCurrentState == State.WalkingLeft)
                        {
                            currentFrame.Y = 5; //This is where Walking Backward is on the sprite sheet
                            ++currentFrame.X; //Increment the column (x) after each loop through update
                            Position.X -= 10; //Decrement on the x-axis to simulate walking backward
                            if (currentFrame.X >= 8) //Check to see if the frame count has been exceeded.
                            { currentFrame.X = 0; } //Set to beginning of column if character still performing action
                        }
                    }
    
                    //Crouch
                    if (currentState.IsKeyDown(Keys.Down) || currentState2.IsConnected && currentState2.DPad.Down == ButtonState.Pressed)
                    {
                        mCurrentState = State.Crouching;
    
                        if (currentFrame.X != 0) currentFrame.X = 0;
                        if (mCurrentState == State.Crouching)
                        {
                            currentFrame.Y = 3; //This is where the Crouch row is on sprite sheet
                            
                            if (currentFrame.X < 3) //Crouching is one continuous animation, if it equals the last frame...
                            { ++currentFrame.X; }//...increment up to 3 and stop
                        }
    
                    }
    


    My crouch only needs to loop to the 3rd frame and stop, but is continuously blinking because of this index problem. Sorry for resurrecting an old topic, figured it'd be better to post a reply than a whole new topic.

    Any help is appreciated, thank you!

    ~Soyaku



    Hello

    
    
    currentFrame.X = 0;
    
    
    

My Information

Member Title:
D.I.C Head
Age:
25 years old
Birthday:
January 14, 1989
Gender:
Interests:
Games,Playing the guitar,Anime
Full Name:
Michael Almyros
Years Programming:
2
Programming Languages:
C,C++,C#,Pascal,PHP,Visual Basic,Java

Contact Information

E-mail:
Click here to e-mail me
MSN:
MSN  Hellbrothsnetcom@hotmail.com
Website URL:
Website URL  http://

Friends

Comments

Hellbroth has no profile comments yet. Why not say hello?