YesNoOk
avatar

Scaling (Read 1555 times)

Started by Feddi09, April 11, 2019, 06:19:16 pm
Share this topic:
Scaling
#1  April 11, 2019, 06:19:16 pm
  • **
  • Kinda New to Creating
    • USA
I want to place an explod/helper on an enemy when they are hit by a certain attack. With that said I want the explod/helper to scale to the size of the target hit. How would one go about doing that?

For
LW
Re: Scaling
#2  April 11, 2019, 08:18:52 pm
  • *****
  • Shame on you!
    • USA
You'd want to spawn a helper with the animation. In that helper you'd use AngleDraw.

If you're trying to cover P2 perfectly, that's probably not going to happen.
I dont know of a way to get the actual pixel size of P2. You'll have to take an educated guess using stuff like
 (target,const(size.ground.front))
 (target,const(size.head.pos))
Target may not work for you because the helper isn't the attacker, but enemynear could do.

You'll probably want to add time/100 to the scale so that it slowly gets bigger, or time/10 so it's a bit faster.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Scaling
#3  April 11, 2019, 08:30:29 pm
  • **
  • Kinda New to Creating
    • USA
Ironically enough I was just looking at your post about your Samus bomb problem. Anyway so what would the formula look like? I don't want it to grow or anything.

[State 0, Helper]
type = Helper
trigger1 = blah
;size.xscale = (target,const(size.ground.front)) * ?
;size.yscale = (target,const(size.head.pos)) * ?
LW
Re: Scaling
#4  April 12, 2019, 08:35:53 am
  • *****
  • Shame on you!
    • USA
More than likely you're going to have to guess it. I'd do it through trial and error. I have my FF3 set up so I can quick launch a bunch of random characters. So testing out the scaling code against multiple people would be pretty fast. When I do stuff like this, I usually attach everything to statedef 200 for testing. Then when it's perfect I move it to where it needs to go.

One thing you'll want to do is open up multiple characters and look at their values. Height may help, but its usually different then head pos. And for random chars that are aliens and not so humanoid you're going to get mixed results.

Looking at my Samus, her head pos is -325. Noob Siabot is -93. So you'll have to come up with a method of detecting what resolution they're in.
felicia's head is -72, Mauru's head is -64.
Onsokumaru's head is -90.
Both Samus and Onsokumaru use xscale. So that's going to go into figuring out their actual size too.

So you have all random sizes. But it all comes down to your sprites original size. If it's 200 pixels tall, you'll have to divide. If it's 10, you'll need to multiply.

I think it's going to be a bit of trial and error to be honest.
vVv Ryuko718 Updated 10/31/22 vVv