YesNoOk
avatar

Shinking opponent? (Read 1826 times)

Started by Sheng Long, September 24, 2013, 09:57:12 pm
Share this topic:
Shinking opponent?
#1  September 24, 2013, 09:57:12 pm
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
How do you shrink an opponent over time?

I know you have to use angledraw, and using it's scale = #,# to do it, but my concern is what math do I need to use to make them shrink using this? Keep in mind it's the opponent being put in a custom state, so I can't use any variables of any kind from an opponent. So the only thing I can think of is maybe do it through time or something.

In other words, I am looking for an alternative to this below:
Code:
[State #, Scale]
type = AngleDraw
trigger1 = Time = 0
scale = 0.8 - 0.8

[State #, Scale]
type = AngleDraw
trigger1 = Time = 1
scale = 0.6 - 0.6

[State #, Scale]
type = AngleDraw
trigger1 = Time = 2
scale = 0.4 - 0.4

[State #, Scale]
type = AngleDraw
trigger1 = Time = 3
scale = 0.2 - 0.2
Etc.....

"You must defeat my flaming
dragon punch to stand a chance."
Re: Shinking opponent?
#2  September 24, 2013, 10:59:37 pm
  • ******
Code:
[State #, Scale]
type = AngleDraw
trigger1 = Time = 0  ; I don't know if it is okay here
scale = 0.8*time, 0.8*time ; I added *time for both the x and y.

Something like this?
Re: Shinking opponent?
#3  September 24, 2013, 11:33:45 pm
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Yea, unfortunately that just makes them grow. :(

"You must defeat my flaming
dragon punch to stand a chance."
Re: Shinking opponent?
#4  September 24, 2013, 11:37:45 pm
  • ******
Last Edit: September 24, 2013, 11:41:49 pm by Alex Sinigaglia
Re: Shinking opponent?
#5  September 25, 2013, 12:04:13 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
You'd want to do 1-(.8*time). What you have there Alex, will give him a negative scale and probably flip the sprite.

-[Все слова это только слова.]-
Re: Shinking opponent?
#6  September 25, 2013, 01:22:53 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
So...... What's the final result should I be looking at here?

For the moment, I'm using a FVar Float Variable on the opponent's custom state, even though I probably shouldn't. That is until I can get a different approach to my problem.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Shinking opponent?
#7  September 25, 2013, 02:04:45 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
The formula for x and y is this:

1-(A*(time-B))

Where:
A = Speed. Smaller values for a slower shrink. Start with .5 and adjust it from there.
B = The offset of time. This will usually be 0, but in case you are using an offset, this is how it would be implemented.
- For example, if you were triggering this at time>=50, then you would have B=50.

Don't use fvars in the custom state unless it's for a full game and you know exactly what each variable is used for within. This solution requires no variables at all.

-[Все слова это только слова.]-
Re: Shinking opponent?
#8  September 25, 2013, 02:32:57 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Code:
scale = 1-(0.9*(Time-100)), 1-(0.9*(Time-100))

This sill makes him grow. :(

Somehow, I need to get "something" to subtract from 0.9 until the scale number hits 0.1. I don't think Time is working. :P

"You must defeat my flaming
dragon punch to stand a chance."
Re: Shinking opponent?
#9  September 25, 2013, 02:46:29 am
  • *****
  • Most Dangerous Mugen
    • USA
    • caddie.smeenet.org
The reason that isn't working is simple mathematics. Think about what the formula is.

1-(0.9*(Time-100))

Let's say that time = 1. It's 1 tick in.

1-(0.9*(1-100))
1-(0.9*(-99))
1-(-89.1)
1+89.1
90.1

There. You just told Mugen to scale the character by 90.
Re: Shinking opponent?
#10  September 25, 2013, 03:07:35 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
So how do I make them scale down without using float variables?

Starting with 0.9, I'm trying to subtract 0.01 until the scale hits something like 0.1, then stops scaling there. The thing that only seems to work is float variables since I have more freedom to subtract whatever I want. But with using Time, it's always in whole numbers, so that's not going to work. :(

"You must defeat my flaming
dragon punch to stand a chance."
Re: Shinking opponent?
#11  September 25, 2013, 03:13:48 am
  • *****
  • Most Dangerous Mugen
    • USA
    • caddie.smeenet.org
Remove the minus 100. And use something other than .9. It's your control. So try this since you said .01:

1-(0.01*Time)

For a test, here's what it is when you plug in some numbers. When time is 1:

1-(0.01*1)
1-0.01
.99

When time is 99:
1-(0.01*99)
1-(0.99)
.01

With that it takes 100 ticks for the scale to be 0. You can adjust the .01 to be slower or faster.  You should also put a limit to it, preventing the scale from getting too small or reaching 0. There are several ways you can do that, using either triggers in the controller or ifelse or whatever.

Edit: Sorry I misread your post, if you want to start with .9, do
.9-(0.01*time)
Just mess around it, I'm sure you get the idea by now. Simple stuff. :)
Last Edit: September 25, 2013, 03:24:34 am by Caddie
Re: Shinking opponent?
#12  September 25, 2013, 03:45:09 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
But what if I am starting at time >= 100? Wasn't that the point of adding -100 into the code?

"You must defeat my flaming
dragon punch to stand a chance."
Re: Shinking opponent?
#13  September 25, 2013, 03:51:36 am
  • *****
  • Most Dangerous Mugen
    • USA
    • caddie.smeenet.org
I dunno, I have no idea how long the person your shrinking has been in their state. You said they were growing and I presented a reason as to why they might be. Here's the options you can do for that though. You CAN add a subtraction to the code but then you have to be sure that you're using the right number for it. If you're not, then what I suggested in my first post in this thread is happening because the "100" is too high of a number.

If your opponent is in a custom state, why not have them changestate right when they're supposed to start shrinking? That way, they do start at time = 0?
Re: Shinking opponent?
#14  September 25, 2013, 03:58:47 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Okay, I think I got something going on.

Code:
[State 1234, AngleDraw]
type = AngleDraw
trigger1 = Time >= 50
scale = 1-(0.01*time), 1-(0.01*time)

Okay the character starts really small when I start at time >= 50, and continues to shrink. So how do I make him start scaling down from 1 beginning at Time 50?


EDIT: I think I got this to work.
Code:
[State 1234, AngleDraw]
type = AngleDraw
trigger1 = Time >= 50
scale = 1-(0.01*(time-50)), 1-(0.01*(time-50))

Does that work?

"You must defeat my flaming
dragon punch to stand a chance."
Last Edit: September 25, 2013, 04:06:27 am by N-Mario
Re: Shinking opponent?
#15  September 25, 2013, 04:06:03 am
  • *****
  • Most Dangerous Mugen
    • USA
    • caddie.smeenet.org
scale = 1-(0,01*(time-49)), 1-(0.01*(time-49))

Try that.

Edit: you can use 50 instead of 49 like you did but it'll start the shrinking a tick later.
Re: Shinking opponent?
#16  September 25, 2013, 04:11:46 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Yea that seems to work. :)

Though it's a lot harder to save the number info of what scale is at when I want it to stop shrinking. Since I won't have the float variables to work with. But I suppose I could guess the last scale number if I needed the info.


Thanks for the help. :)

"You must defeat my flaming
dragon punch to stand a chance."