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 7988587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:30:00+00:00 2026-06-04T12:30:00+00:00

Hey I’m currently making a 2D fighter a lot like the good old Mortal

  • 0

Hey I’m currently making a 2D fighter a lot like the good old Mortal Kombats using XNA 4.0. Anyway, I’m currently trying to program a punch animation.

The player is in the Idle state and on pressing Left Control, the player should punch.

Now assume the player is facing the left of the screen. All my sprites are drawn facing the right. So when the player punches, the sprite is flipped and drawn.

Problem is, the animation makes it look like the player teleports to the right abruptly because it is aligning the left most part of the flipped punch frame with the left most part of his idle frame (that’s what I think at least). I cannot seem to think of a way to fix this.

My code is quite big right now. If someone could identify a possible section of the problem, I’d be glad to post that code.

  • 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-06-04T12:30:02+00:00Added an answer on June 4, 2026 at 12:30 pm

    Okay so I fixed that problem. Indeed the problem was the sprite sheet. The guy who designed it, did not center each image in each frame.

    So then, he centered all the images, but the frames were of varying sizes. But that problem persisted.

    After some debugging, I figured out what was happening. In the Idle frames, there was a 2-pixel space on either side of the character in those frames. In the Punch frames, there was a 23-pixel space on either side of the character in those frames.

    My Draw() function was drawing each frame based on a 2D position Vector. This position Vector, specifies the top-left corner of each frame.

    Now since the Idle frames and the Punch frames have differing pixel widths to the left of the characters in each frame, it looked like the character “teleported” when the player presses Punch.

    Now my solution for this problem – make all the frame sizes the same! This solved my “teleportation” issue. I could’nt figure out any alternative solutions to this problem though.

    Now there’s one thing I don’t understand. There are so many games where sprite sheets are made up of different frame sizes. How do they use them without this teleportation issue?!

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

Sidebar

Related Questions

Hey folks I am trying to implement a search functionality in a website using
Hey guys I am making a terminal application using Swing and Apache Commons. I
Hey guys I am new to android development, I am currently making an application.The
Hey I want to write a struct like the XNA Color struct or the
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey right now I'm using jQuery and I have some global variables to hold
Hey having some trouble trying to maintain transparency on a png when i create
Hey trying to get a validation check working on a boolean field called 'activated'.

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.