Infinity MUGEN Team

IMT Main => M.U.G.E.N Guides & Tutorials => Topic started by: O Ilusionista on April 22, 2011, 10:50:19 PM

Title: Sine movement - stages & chars
Post by: O Ilusionista on April 22, 2011, 10:50:19 PM
I will talk about how to make Sine movement on chars and stages, to make more smooth animations.
I will explain more about Sine below.

STAGES:
take a look at  http://www.elecbyte.com/mugendocs/bgs.html (http://www.elecbyte.com/mugendocs/bgs.html) for more info about stages

[BG mirror]
type = normal
spriteno = 6,0
start = 0, -142
delta = 0.7,0.9
layerno = 0
mask = 1
sin.y = -8, 240


Let me explain the trigger:

sin.y = -8, 240

- Sin is senoide curve
(http://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Sin.svg/400px-Sin.svg.png)
http://en.wikipedia.org/wiki/Sine_wave (http://en.wikipedia.org/wiki/Sine_wave)

- sin.y means that we are going to have the effect just on the y axis (vertical). For horizontal movement, use sin.x   (*)

- -8 is how much the element will move (keep in mind that we are talking about a Senoide, so it will move the amount*2 = 16 (-8 and 8).

- 240 is the total time of a whole curve (the up and the down anim).

Some images to illustrate the effect:
(http://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/ComplexSinInATimeAxe.gif/400px-ComplexSinInATimeAxe.gif)

(*) on Mugen 1.0 this parameter is basically superseded by the SinX background controller.
Look at http://www.elecbyte.com/mugendocs/bgs.html#background-controllers (http://www.elecbyte.com/mugendocs/bgs.html#background-controllers)

CHARS:

On chars, its a bit more complex.

From SodonHID's codes:
Quote
[State xxx, x]
type = VelSet
trigger1 = 1
X = 3*sin(time/4.0) ; ** Originally, it was (time/4)
Y = 3*cos(time/4.0); ** Originally, it was (time/4)

4 is the frequency (the "speed"). 3 is the range (or amplitude, diameter)

** Using Bia words:
It may seem ridiculous, but time/4 will never bring a fractional result (5 / 4 = 1 for mugen). While time/4.0 results in a fractional number.

To summarize:
value / integer = integer division (without fraction). The result is an integer
value / actual value (eg 1.0) = split real (fraction). The result is a real number.


By ChonWang:
Just to help:

x = sin (time * A) * B
y = cos (time * A) * B

. The lower | A | and | B |, spins more slowly
. The lower | A | or higher | B |, the larger the radius


Notes:
- Signal (A × B) indicates the direction: counterclockwise (+), clockwise (-)
- The addition of VelAdd creates a helix
- | x | x is the module, ie the absolute value of x.

hope that is helps.
Title: Re: Sine movement - stages & chars
Post by: Luigi-Master on April 23, 2011, 02:27:15 AM
Umm...I'm not very sharp when it comes to this, but what exactly is this used for?  I'm kinda lost.   :-??
Title: Re: Sine movement - stages & chars
Post by: O Ilusionista on April 23, 2011, 04:19:30 AM
For making things (like the char, or projectiles, or some part of the BG) move up and down (or on a circle motion)
Title: Re: Sine movement - stages & chars
Post by: Luigi-Master on April 23, 2011, 10:11:57 AM
Oh, that!  For a minute I thought we were going to go into 3Dimensional stuff.

I wonder, is there a way for a projectile to have the same (or at least similar) physics to the fire balls in Super Mario?  I was thinking they would constantly use gravity to move down, but when it gets near the floor, it jumps up a short bit (with a velset) and it continues like this.
Title: Re: Sine movement - stages & chars
Post by: O Ilusionista on April 23, 2011, 01:28:19 PM
Its so simple:

Make a helper with this

[state 0,0]
Type = VelAdd
Trigger1 = 1
y=0.25

Its so simple:

Make a helper with this

[state 0,0]
Type = VelSet
Trigger1 = Pos Y>=0
y=-6

Change the -6 to make it bounce more.
Title: Re: Sine movement - stages & chars
Post by: Luigi-Master on April 23, 2011, 01:59:52 PM
Hah, didn't know it was that easy.  A lot of characters who use fireballs have improvised physics, such as the sine motion you mentioned before, or the sprite itself is animated like that.  Thanks.
Title: Re: Sine movement - stages & chars
Post by: O Ilusionista on April 23, 2011, 05:27:10 PM
you´re welcome, товарищ
SimplePortal 2.3.5 © 2008-2012, SimplePortal