Mythruna
April 27, 2024, 07:28:58 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: Help making Player_Side sprite  (Read 12966 times)
Budehgong
Donators
Full Member
***
Posts: 101



View Profile
« Reply #15 on: June 14, 2013, 02:11:43 PM »

I think you could figure it out just by looking at the pictures you've shown us here, (especially the first one) and it shouldn't be too hard to figure out what needs to "stick out" when he walks.
I think the leg should be easy; just a slightly sloped line down, then an angle an back towards the ancle to finish of with a foot.
You might want to anle the other leg as well, like this: //\\
........................................................................//  ||   ......but properly.

Logged

Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #16 on: June 14, 2013, 05:08:09 PM »

This is kind of pathetic, but I will need help making it a 3-frame animation, considering everything I am trying jacks up the process, this is the code that actually runs the 2-frame animation while the player is walking:

Code:
if (dir == 0) {
     sprite = Sprite.playerF;
     if (walking) {
          if (anim % 40 > 20) {
               sprite = Sprite.playerF_1;
          } else {
               sprite = Sprite.playerF_2;
          }
     }
}
The variable dir is used to keep track of what way the player is facing, in this case it is equal to zero, which will display them going up on the y-axis (forward).

The variable anim is short for animation, which I am using to get the 2-frame animation by getting the remainder (using a modulus '%' for those who don't know).
Logged
Sean
Donators
Hero Member
***
Posts: 598



View Profile
« Reply #17 on: June 14, 2013, 07:36:57 PM »

I know absolutely nothing about java, but could it be possible to do something like:
if it is neither of the 'outside' sprites, then use the middle sprite?

At least that's what I would do in Python; but I don't know how helpful if/else is when trying more than 2 variables since basically the way it is set up is "if it is not 0, then use 1".
the simplest way I could think about doing it is to have two middle sprites that are exactly identical so you can call upon them in a linear fashion with four different sprites to call upon.
Again I don't if that is even possible since I don't know how java works so I can't be of any more help.
Logged

"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #18 on: June 14, 2013, 07:56:18 PM »

I tried instead of finding the remainder, just use anim as 1, if 0 use my first image, if 1, use the default image, and if 2, use the 2nd image and revert anim back to 1. The problem was was setting the delay because he was in freaking warp speed. You could literally see the blur. Smiley
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #19 on: June 14, 2013, 09:38:11 PM »

It's only a two frame walkcycle, I assume that's where the problem lies.

That's one of the reasons I kept stressing the need to go back to the resting frame.
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!