Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6113067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:48:59+00:00 2026-05-23T14:48:59+00:00

Mmm it’s difficult to explain it so I will do my best… I have

  • 0

Mmm it’s difficult to explain it so I will do my best…

I have this method:

private void manageActions(long delta) {
    lastFrameChange += delta;

    if(currentAction == States.Action.STANDING) {
        lastFrameChange = 0;
        resetDirections();
    }

    if(currentAction == States.Action.WALKING) {
        switch(currentDirection) {
            case UP:
                if(lastFrameChange > 75.0f) {
                    lastFrameChange = 0;
                    if(++currentFrame > 2)
                        currentFrame = 1;
                }
                break;
            case DOWN:
                if(lastFrameChange > 75.0f) {
                    lastFrameChange = 0;
                    if(++currentFrame > 5)
                        currentFrame = 4;
                }
                break;
            case LEFT:
                if(lastFrameChange > 75.0f) {
                    lastFrameChange = 0;
                    if(++currentFrame > 7)
                        currentFrame = 6;
                }
                break;
            case RIGHT:
                if(lastFrameChange > 75.0f) {
                    lastFrameChange = 0;
                    if(++currentFrame > 9)
                        currentFrame = 8;
                }
                break;
        }
    }
}

It is a method to change the frames of a character based on his orientation and status (stand, walking …) The problem is that when my character moves upward and then right, it pass through all the frames that between them. This is because the currentFrame variable is not resetted each time you change orientation with the right direction, and the last frame is keeped.

One more thing, resetDirections() set the currentFrame variable to the standing frames of the character.

I have been thinking when to reset this variable but I don’t have any idea :/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:49:00+00:00Added an answer on May 23, 2026 at 2:49 pm

    You need to keep another variable, “previousDirection”, that’s set at the end of the method.
    When you enter the method, check if there’s been a change of direction and set lastFrameChange and currentFrame accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this textbox on the page: <%= Html.TextBox(EffectiveDate, Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString(dd-MMM-yyyy) :
I have this textbox: <%= Html.TextBox(EffectiveDate, Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString(dd-MMM-yyyy) : , new { @class
I have path /doc/dev/documentum/data/MMM/content_storage_01/00002710/80/00/00/d3.txt How to get r_object_id of this content?
I have dates being output in this format: 14-MAR-2011 (DD-MMM-YYYY) for example. Is it
I have this regular expression. MMM D[,] YYYY /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\ (\d{2})\, (\d{4})$/ How i can
I would have thought this was: .datepicker({ dateFormat: 'dd-mmm-yyyy' }); for month, I get
mmm, I have just a little confusion about multiple auto declarations in the upcoming
Right now for my ConversionPattern I have: log4j.appender.A1.layout.ConversionPattern=%d{yyyy MMM dd HH:mm:ss,SSS} %5p [%t] (%F:%L)
I have a Date format: 2009-08-10T16:03:03Z that I want to convert to: @MMM dd,
how to ask in C# Winform if this format: ddd MMM d HH:mm:ss yyyy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.