collapse

Author Topic: Sine movement - stages & chars  (Read 1017 times)

0 Members and 1 Guest are viewing this topic.

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12459
  • Country: Brazil br
  • Last Login:Today at 01:17:37 AM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Sine movement - stages & chars
« 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 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://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:


(*) 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

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.



Offline Luigi-Master

  • Skull fetishist
  • Forum Member
  • ***
  • Posts: 404
  • Last Login:December 08, 2013, 03:47:08 AM
  • Soviet enthusiast
    • Email
Re: Sine movement - stages & chars
« Reply #1 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.   :-??

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12459
  • Country: Brazil br
  • Last Login:Today at 01:17:37 AM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Re: Sine movement - stages & chars
« Reply #2 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)

Offline Luigi-Master

  • Skull fetishist
  • Forum Member
  • ***
  • Posts: 404
  • Last Login:December 08, 2013, 03:47:08 AM
  • Soviet enthusiast
    • Email
Re: Sine movement - stages & chars
« Reply #3 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.

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12459
  • Country: Brazil br
  • Last Login:Today at 01:17:37 AM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Re: Sine movement - stages & chars
« Reply #4 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.

Offline Luigi-Master

  • Skull fetishist
  • Forum Member
  • ***
  • Posts: 404
  • Last Login:December 08, 2013, 03:47:08 AM
  • Soviet enthusiast
    • Email
Re: Sine movement - stages & chars
« Reply #5 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.

Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12459
  • Country: Brazil br
  • Last Login:Today at 01:17:37 AM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Re: Sine movement - stages & chars
« Reply #6 on: April 23, 2011, 05:27:10 PM »
you´re welcome, товарищ

Tags:
 


* IMT Facebook

Help us by Donating!

IMT Discord

Join us at our Discord! Click the image below!

* IMT Shoutbox

Sorry, this shoutbox does not exist.

* Recent Posts

* IMT Calendar

April 2024
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 [27]
28 29 30

SimplePortal 2.3.5 © 2008-2012, SimplePortal