YesNoOk
avatar

Rock type characters help: Running and shooting animations (Read 2276 times)

Started by RedDragonCats17, May 21, 2019, 08:29:55 pm
Share this topic:
Rock type characters help: Running and shooting animations
New #1  May 21, 2019, 08:29:55 pm
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
If you don't know what Rock type characters are, they are the characters that rely on long range combat and have the ability to run and shoot. I need help in making the running and shooting frames match the standard running frames.

This is going to be tricky to explain, but I'll try my best.

Let's say that you're running around the arena and you start firing. If you're on a specific frame, like frame 3, and you shoot, the running and shooting animation will start on that specific frame. Some good examples of characters doing this would be Fusion's MegaMan X, Ahuron's Ultimate Armor, N64Mario's Vent and Aile, and Ahuron's NES MegaMan.

I want to start with my NES MegaMan (secret character) and Model X first, because they're not as hard as what MegaMan and MegaMan X are going to be. Model X is going to be a little more difficult, primarily because she has 2 running and shooting animations. (It is a she in this case, because I'm using Aile right now)





They may look the same at first glance, but if you had the character SFF and you zoomed up to the sprites, there is a difference.

That aside, how can I make the running and shoot animations work on any of the frames of the running animation?
Last Edit: June 05, 2019, 11:45:39 pm by RedDragonCats17
Re: Rock type characters help: Running and shooting animations
#2  May 21, 2019, 09:47:32 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
When you ChangeAnim, you can change to a specific animelem by using the "Elem" parameter.

So, what you should do is have one Shooting anim (the full anim), and use a Var to change to the correct elem value.
You can apply this logic to any animations that you want to jump into depending on what frame you were just on.

In your walk state, you can set the Var using a Null controller like so

[State 20, Log the current animelem]
type = Null
trigger1 = Time = 0 || animtime = 0
trigger1 = var(1) := 0
trigger2 = anim = 20 && AnimElem = 1
trigger2 = var(1) := 1
trigger3 = anim = 20 && AnimElem = 2
trigger3 = var(1) := 2
trigger4 = anim = 20 && AnimElem = 3
trigger4 = var(1) := 3

etc

Then in your attack state

[State 200, Shoot]
type = ChangeAnim
trigger1 = time = 0
elem = var(1)


If you want to use this same behavior for various movements like walkback, jumping, etc, you could stick the Null controller in State -3 and just factor those anims into the triggers.


You can also just have your attacks in the same state as your movement (so you never leave the state).  Just be sure to use StateTypeSet, you can change to a specific animelem by using the "Elem" parameter.

Re: Rock type characters help: Running and shooting animations
#3  May 22, 2019, 01:07:48 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
Okay, so it does work on NES MegaMan, the thing is he's not moving, he's just statically walking. How do I keep him moving?

(I wasn't paying attention about the other post, my bad)
Re: Rock type characters help: Running and shooting animations
#4  May 22, 2019, 03:52:17 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
The walk state should have a VelSet controller, so you just need to adjust the triggers so that it continues applying forward velocity when you change to the shooting anim.

Re: Rock type characters help: Running and shooting animations
#5  May 22, 2019, 05:10:39 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
So should I use the variable for a trigger or stateno != 200 or something?
Re: Rock type characters help: Running and shooting animations
#6  May 22, 2019, 07:48:21 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
No. You should use the button you press or hold to make him do that. Otherwise hes going to do it when you don't want him to. Please think about the situations not just the sodding outcome its going 5o help you so much.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Rock type characters help: Running and shooting animations
#7  May 22, 2019, 08:04:35 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
Like this?

Code:
[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
trigger2 = command = "x"
x = const(velocity.walk.fwd.x)

The reason why I use a trigger 2 is because pressing X is not required to even move, it is required to walk while shooting, though.
Re: Rock type characters help: Running and shooting animations
#8  May 22, 2019, 10:01:45 am
  • *****
  • Shame on you!
    • USA
So you still dont know how triggers work?
trigger2 = command = "x"
because pressing X is not required to even move
When trigger 2 happens, the velset happens.

----
First off, I'm not sure where/what state you're using for this. But why aren't you setting the velocity in the StateDef????
What ever you have to do to get into the state, walking or whatever, you've done it.
Now,
If you stop doing it?
You'll switch states.
1 velset should suffice

This isn't even a question man.
vVv Wheat Stage Released vVv
Last Edit: May 22, 2019, 10:25:59 am by Odb718
Re: Rock type characters help: Running and shooting animations
#9  May 22, 2019, 10:27:00 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
Well what am I supposed to do then? Just saying "I just need to adjust the triggers" and "I should use the button I press or hold" helps me none.
Last Edit: May 23, 2019, 05:01:48 am by RedDragonCats17
Re: Rock type characters help: Running and shooting animations
#10  May 24, 2019, 01:01:43 am
  • *****
  • Shame on you!
    • USA
First off, I'm not sure where/what state you're using for this. But why aren't you setting the velocity in the StateDef????
You should be able to answer this question. It's to get you to realize what you actually need to do. You want the velocity set for the entire time you're in the state right???
Spoiler, click to toggle visibilty

Why do you think you need TWO triggers for your velset?
vVv Wheat Stage Released vVv
Last Edit: May 24, 2019, 01:06:20 am by Odb718
Re: Rock type characters help: Running and shooting animations
#11  May 24, 2019, 02:44:40 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
Answering your question real quick, I'm doing this for the standard shot, which is state 200. Some MegaMan characters have a separate state for walking and shooting, but idk if it'll be the case here, based on altoiddealer's instructions.

I never use the velset in the state def. The velset state controller gives me more freedom on when I want a character to move when doing a certain action. I honestly don't know what you have in mind for the velset in the statedef.

As of now, the statedef looks like this:

Code:
;---------------------------------------------------------------------------
; Standard Shot
[Statedef 200]
type    = S                      ;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A                      ;Move-type: A-attack, I-idle, H-gethit
physics = N                      ;Physics: S-stand, C-crouch, A-air
juggle  = 1                      ;Number of air juggle points move takes
velset = 0,0                     ;Set velocity (x,y) (Def: no change)
ctrl = 0                         ;Set ctrl (Def: no change)
anim = 200                       ;Change animation (Def: no change)
poweradd = 0                  ;Power to add (Def: 0)
sprpriority = 2                  ;Set p1's sprite layering priority to 2 (in front)
Re: Rock type characters help: Running and shooting animations
#12  May 24, 2019, 09:47:24 am
  • *****
  • Shame on you!
    • USA
You seem to have jumbled up what Altoid said and thinks you did.

You can also just have your attacks in the same state as your movement (so you never leave the state).  Just be sure to use StateTypeSet, you can change to a specific animelem by using the "Elem" parameter.
The walk state should have a VelSet controller, so you just need to adjust the triggers so that it continues applying forward velocity when you change to the shooting anim.

The way you seem to be doing it, probably isn't how any of us imagined to do it. But it does make sense.
All you need to do is check if P1 is holding forward to change the animation to walking. Nothing else needs to affect it walking right?
You're going to run into a few problems using a state that usually stands still.
#1, what happens if P1 presses forward in the middle of the regular state 200 animation???
#2, what happens if P1 lets go of forward in the middle of the walking shoot animation???

Because you want this one state to be loaded 2 different ways, through 2 different ways of loading it, You're going to need to be able to check which way you came in.
PrevStateNo
is an obvious choice. It has it's weak points.

To cut a lot of headaches out, Duplicate your 200 state, rename it, and switch to that while walking.
Make sure you reset the variable right above your changestate when you leave the state. You dont want to cause issues with it not knowing what sprite to load up because it didn't start at 0 the 2nd time around.

Is
physics = N 
How you originally had the state? Or did you switch it because of what I mentioned? Mega Man has some odd physics, but usually a standing attack has
physics = S
because it's standing.
vVv Wheat Stage Released vVv
Re: Rock type characters help: Running and shooting animations
#13  May 24, 2019, 12:19:59 pm
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
It was originally S, but you were right, I switched it because of what you mentioned.

I duplicated the state, and I remade everything in the original to how it originally was. How do I make the changestate (or whatever you have in mind) to switch to this new state while walking? I know about the variable reset, but I don't have a clear vision on what I have to put in the switch, aside from prevstateno.
Re: Rock type characters help: Running and shooting animations
#14  May 24, 2019, 04:33:52 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Sorry if I just added confusion heh :)  This is not a particularly simple problem to solve.

I'm going to add some code to default walk state and Kung Fu Man's State 200 and paste it below, so you can see what I was thinking of.

Spoiler: Default Walk State that logs your current animelem to a Var (click to see content)

Spoiler: KFM State 200 that recognizes the AnimElem from Walk State (click to see content)



*Edit* so, if you understand the above and manage to make it work for you, you will notice that when you switch to the Shooting anim that the animelem will play slightly longer than expected.  This is b/c your animelems are several ticks in duration, and you are essentially changing to the same animelem from the first tick.
To solve this problem, you can duplicate the frames in your Walk and Shoot anims so that every frame of animation is only 1-tick in duration (and add more triggers to the Null controller). So like if the first elem is 4 ticks long, duplicate this so you have 4 frames @ 1-tick each.
You will then be keeping track of every tick of animation, and it will look much smoother.

Last Edit: May 24, 2019, 06:26:23 pm by altoiddealer
Re: Rock type characters help: Running and shooting animations
#15  May 25, 2019, 05:18:45 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
Should I add command = holdforward to the change anim? Rock will automatically go to the walk and shoot anim immediately if I keep it as it is.

-----

Actually, Odb, what do you think about this method?

-----

Okay, so I tried to take matters into my own hands and try to make the walk and shoot state by myself using N64Mario's MMZX characters as a reference.

Here's the changestate for going into 201:

Code:
[State 200, 3]
type = ChangeState
triggerall = Time >= 0 ;This was part of N64Mario's code, but I adjusted it because Rock will shoot more than 1 projectile in seconds.
trigger1 = command = "holdfwd" ;Obviously.
value = 201
ctrl = 1

And here's the state itself:

Spoiler, click to toggle visibilty

To Odb: Yes, I am using a projectile for Rock, and this particular version of Rock is not going to be ported to regular MUGEN because there are already versions of him that are just like this and one of them is technically fighting game friendly, and we don't know when KingPepe will port his version from Famicom Fighters, but when he does, that's a instantly better version of him since he's fighting game friendly. So this version of Rock is an exclusive along with the bosses.

Anyway, I've had some success, but Rock goes into his shooting walking animation for about half a second, as you can see here.

https://streamable.com/uy18t

If there's any way you guys could help me out and fix these things, I'd appreciate it big time. Idk how I'll repay you, but I'll go as far as to stay silent on the Discord.
Last Edit: May 29, 2019, 01:44:44 am by RedDragonCats17
Re: Rock type characters help: Running and shooting animations
#16  May 29, 2019, 06:21:27 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
How many Elems are in the walking anim, and in the shooting anim?

Can you upload the 2 anims as well?

Re: Rock type characters help: Running and shooting animations
#17  May 29, 2019, 06:37:13 pm
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
There are 5 elems in both, and here they are:



Re: Rock type characters help: Running and shooting animations
#18  May 29, 2019, 08:25:02 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I have time on my hands, so how about just copy/paste your code for State 20 and any other states that have to do with running (If anything else other than what you've already shared).  I'm going to solve most of this for you, but don't worry you'll still have a few things to do :)

Last Edit: May 29, 2019, 08:28:30 pm by altoiddealer
Re: Rock type characters help: Running and shooting animations
#19  May 30, 2019, 01:03:44 am
  • ***
    • USA
    • Skype - reddragoncats17
    • reddragoncats17.weebly.com/
Spoiler, click to toggle visibilty

Spoiler, click to toggle visibilty

This is all I got for now. I have played the GB MegaMan games, and I only remember the metal blade being a useful weapon.
Re: Rock type characters help: Running and shooting animations
#20  May 30, 2019, 03:55:06 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Here's what I think you should do, at least for this more basic Mega Man character... follow along closely.
If there is any code you do not understand, you should refer to the State Controllers and Triggers docs.

Back up your character (CONSTANTLY back up your character)

1.There should only be 4 elems in the running anim.
-The first elem of the Run anim is probably your idle anim, yes?  It should not be in the walk anim at all.
-The first sprite in your attack anim should only be in its own unique anim, because this sprite is only correct when he is standing still and shooting, yes?  Assign this sprite to Anim 202, and give it an 8-tick duration.
-You can simply delete Anim 201.  You'll see why in the following instructions.

2. I am recommending that you use ONE Player Anim that does not have the arm(s) in the animation, and then overlay the arms as Explods.
-The body will be the player anim 20 (and 21).  You can use whatever duration for the elems (you are using 8 ticks per frame, yes?)
-The Arms (running) will be anims 17, 18 and 19.  These anims must be 1-tick in duration (the code will control them).
-The Arms (run/shooting) will be anims 22 and 23.  These anims must be 1-tick in duration (the code will control them).
Spoiler: preview anims (click to see content)
Spoiler: The Sprites (click to see content)

-Do not ChangeAnim when going into State 201 from state 20.  Allow the "body" animation to just continue.
-Only changeanim from State 0, for the one I mentioned first (anim 202).

Alright, now here's the code.
So long as you add the sprites and create the various anims as described above, this will work exactly as you want it to.
Spoiler: The Code (click to see content)


Let me know if you have any questions.

*Edit* if you want the .PSD with running sprites split up, you can download it here.  It might be easier for you to save the sprites yourself, to set up your palettes.

Last Edit: May 30, 2019, 05:25:48 pm by altoiddealer