YesNoOk
avatar

"Tractor Beam" attack - how to deal with axis (Read 169 times)

Started by altoiddealer, December 28, 2014, 04:55:13 pm
Share this topic:
"Tractor Beam" attack - how to deal with axis
#1  December 28, 2014, 04:55:13 pm
  • **
    • USA
    • altoiddealer@gmail.com

  • Online
There is probably a very simple answer for this that I'm just not seeing.  I'm still lacking a bit in the Experience Dept.


For those not familiar with my project, my character has a screen for a face.

I'm working on a super move, where my character emits a light (cone shaped, like a flashlight).

If P2 makes contact with it, he is sent into a custom state, and then sucked into the "screen":
-P2 gets FreezePos for 40 ticks... so will freeze instantly
-After 40 ticks, P2 is dynamically scaled from 1 to 0 during the course of the next 60 ticks
-During these 60 secs, P2 floats into my chars face, followed by a ridiculous fullscreen arcade sequence.

MY ISSUE:
I can calculate the correct X and Y velocities to make P2 gravitate to the center of the "screen," regardless of position... but it would be a heck of a lot easier and accurate if I can force P2s axis to be centered on the mid section.

I believe I need to put P2 into a custom throw anim with centered axis, but I don't know how to accurately make the switch (without anim jumping from one place to another).  Maybe this isn't the solution I need, though.

Any help appreciated.  Thanks!
Re: "Tractor Beam" attack - how to deal with axis
#2  December 29, 2014, 03:25:17 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
I believe that what you're looking for is within the common required sprites. I'm not sure if you've seen this or not, but I'll leave it here for you: http://elecbyte.com/mugendocs/spr.html. It's the list of all common required sprites with pictures near the bottom. Extremely useful. I use it for reference all the time. :)

In your custom state animation, you would use 5001,0 for example to center P2 in the middle. If you need both types of sprite-positioning, you can rely (usually) on const(size.height)/2 or const(size.mid.pos.y), though keep in mind these are based on how the author set them in their character. My idea is that you could use the offset of either of those values (or possibly the average of both :P) to make your centered sprite appear on the ground for the short time your need.

If I'm way off, let me know, lol. I think this is what you're talking about though.

-[Все слова это только слова.]-
Re: "Tractor Beam" attack - how to deal with axis
#3  December 29, 2014, 03:34:09 pm
  • ****
  • play more SNK games
    • South Africa
    • www.trinitymugen.net/
When the attack hits the opponent, make the screen flash white :P

Nobody will notice the sudden jump in anims
Re: "Tractor Beam" attack - how to deal with axis
#4  December 29, 2014, 03:47:26 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
When the attack hits the opponent, make the screen flash white :P

Nobody will notice the sudden jump in anims

Lol, it wouldn't be the first time we've hidden mugen's flaws with aesthetics. XD

-[Все слова это только слова.]-
Re: "Tractor Beam" attack - how to deal with axis
#5  December 29, 2014, 04:15:56 pm
  • **
    • USA
    • altoiddealer@gmail.com

  • Online
I believe that what you're looking for is within the common required sprites.

I have a custom get-hit anim for P2 using that sprite :)  But the issue is that the animation jumps depending on where P2's axis orientation is when touching the light.

I'm hoping to have the animation behave as I envision, with P2 freezing immediately when he touches the light, whether standing, crouching, in mid-air or whatever, then flying directly into the center of Jailbot's face.  I have a basic understanding of throw mechanics, but I'm not keen on changing the axis orientation smoothly between frames (or in this case, States)

When the attack hits the opponent, make the screen flash white :P

Nobody will notice the sudden jump in anims

Heh, I'll take that into consideration :)
Re: "Tractor Beam" attack - how to deal with axis
#6  December 29, 2014, 04:21:55 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
I have a custom get-hit anim for P2 using that sprite :)  But the issue is that the animation jumps depending on where P2's axis orientation is when touching the light.

I'm hoping to have the animation behave as I envision, with P2 freezing immediately when he touches the light, whether standing, crouching, in mid-air or whatever, then flying directly into the center of Jailbot's face.  I have a basic understanding of throw mechanics, but I'm not keen on changing the axis orientation smoothly between frames (or in this case, States)
Ah okay. Good! :) Really, it's just a matter of offsetting the extra distance by calculating how much the sprite is off. You would just trigger that on the frame/state/whatever that you need it to. The sctrl would probably be Offset. I've had issues with PosFreeze in the past, but I think it was just my situation. See how it works for you though.

-[Все слова это только слова.]-
Re: "Tractor Beam" attack - how to deal with axis
#7  December 29, 2014, 04:38:46 pm
  • **
    • USA
    • altoiddealer@gmail.com

  • Online
Ah okay. Good! :) Really, it's just a matter of offsetting the extra distance by calculating how much the sprite is off. You would just trigger that on the frame/state/whatever that you need it to. The sctrl would probably be Offset. I've had issues with PosFreeze in the past, but I think it was just my situation. See how it works for you though

I get the concept here, but I'm clueless on calculating the necessary offset.  I can make this work for one specific state against one specific opponent, but I'm totally lost on how to do this against any opponent, in any anim.
Re: "Tractor Beam" attack - how to deal with axis
#8  December 29, 2014, 05:52:58 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
I get the concept here, but I'm clueless on calculating the necessary offset.  I can make this work for one specific state against one specific opponent, but I'm totally lost on how to do this against any opponent, in any anim.
The only thing I can think of is to rely on the enemy constant (const) values. You'll be jumping from center to origin (or vice versa) right? Regardless of enemy size, if they have properly set size.height in their character, then half of that would be your offset. You can try to account for if it's not set by providing some sort of fallback value to minimize the jump.

-[Все слова это только слова.]-
Re: "Tractor Beam" attack - how to deal with axis
#9  December 29, 2014, 06:54:34 pm
  • **
    • USA
    • altoiddealer@gmail.com

  • Online
Well, I'll chew on that for awhile, but for now I will mark this as solved and use OffSet (which seems like it will work good in most cases).  This is one of those State Controllers I flip past all the time thinking "why the hell would I ever need to use that?!" - but it's doing the trick here!

I'll probably add some flashy effect to make the sudden axis switch look less noticeable.

Code:
[State 3303, 1]
type = Offset
trigger1 = Time = [0,100]
y = Const(size.mid.pos.y)

Thank you again!!! My hero!
Re: "Tractor Beam" attack - how to deal with axis
#10  December 29, 2014, 07:35:08 pm
  • ****
  • Hey.
    • Ukraine
    • mugencoder.com

  • Online
No problem man! The final result is going to be insanely awesome. I can't wait! XD

-[Все слова это только слова.]-