Little Fighter Empire - Forums
Facing of a Buff - Printable Version

+- Little Fighter Empire - Forums (https://lf-empire.de/forum)
+-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7)
+--- Forum: Data Changing (https://lf-empire.de/forum/forumdisplay.php?fid=11)
+---- Forum: Tutorials (https://lf-empire.de/forum/forumdisplay.php?fid=12)
+---- Thread: Facing of a Buff (/showthread.php?tid=4338)



Facing of a Buff - Alblaka - 01-13-2010

Actually, i never saw an explanation for this kind of things.
Also, search neither revelead something in the forum, nor on the mainsite.


This tut will explain, how to create a buff/upgrade/power-up which with automatically change the facing direction when the character does so.

As already known and public, a itr with kind: 8 will stick to the T0 it "hits". (For further information on itr/kind:8 you can check THIS link)
But it neither changes it's y-value, nor it's facing direction.

The problem is, if you now have, f.e., a guy punching.
This guy can upgrade his punch (with a move), so the punch will have some glow effect or whatever.
After the upgrade you turn around, punch... and the upgrade will spawn/create/show the glowing/whatever sprites still on the other side.

To prevent this you need following technique:
The kind:8-object has, instead 1, 2 itrs with kind:8.
Short info on Special Bodys (Click to View)
We will take a basic char stance for our example:
Usually, most characters have centerx: 39 and centery: 79 (last one is actually unimportant). Now you make 2 Special Bodys (it's possible to make about 10 bdys per frame, so don't worry about overloading the dat-file):
Code:
(...)centerx: 39  centery: 79(...)
   bdy:
      kind: 0  x: 49  y: 1230000  w: 50  h: 1000
   bdy_end:
As you can see on the x-coordinate, this Special Body is on the "right" of the character (since centerx: 39 is the middle). And "right" is the facing direction.

Now comes the tricky part: 2 itr/kind:8
Code:
(...)centerx: 39  centery: 79(...)
   itr:
      kind: 8  x: -71  y: 1230000  w: 100  h: 1000 dvx: abc
   itr_end:
   itr:
      kind: 8  x: 49  y: 1230000  w: 100  h: 1000 dvx: xyz
   itr_end:
Usually, an upgrade that is supposed to turn to the correct side is already "sticked to the char", it haves the same centerpoint. Since we are using the same centerx/y values for the char AND the object, getting the correct coordinates is quite easy (but you can of course use any values, it's just more calculating).
The first itr displayed above, reaches from -71 up to 29, the second one from 49-149. So, the first is left (behind) of the char, the second one right (in front).

If the char is facing the same direction as the object, the char will have the Special Body on the "right" side. Therefore, the second itr/kind:8 will trigger and bring the kinf:8-object to frame xyz (which could be the glowing sprites from the example noted above).

If the char is NOT facing the same direction, the Special Body will be on the "left" side. Now the first itr/kind:8 will trigger, which leads to frame abc.
This frame abc just haves a basic turning command (negative next value), leading back to xyz.


In effect:
The kind:8-object will ALWAYS have the same facing as the char with the Special Body itself.



Free for discussions, comments and critics now, is the first tut i've ever written :D


RE: Facing of a Buff - Bamboori - 01-13-2010

great tut, but i am missing a study example :)


RE: Facing of a Buff - no one - 01-13-2010

Man, I was thinking about posting a tutorial cover the same aspect but you ninja'ed me with your awesome-overloaded tutorial ;).

@Bamboori:The tutorial is really easy to understand + got some code ready for use so I don't think you will need any study example.

EDIT: thanks for pointing that out Bamboori.


RE: Facing of a Buff - Bamboori - 01-13-2010

(01-13-2010, 02:37 PM)no one Wrote:  @Bamboori:The tutorial is really easy to understand + got some code ready for use so I don't think you won't need any study example.

in other words, you appreciate one as well :P


well, its true, uts easy to understand, but without study example it will never go to the website.


RE: Facing of a Buff - Alblaka - 01-13-2010

Actually, i invented this method for the char "Kato" (vvv look into sig), so a "study example" will soon be avaible ^^


RE: Facing of a Buff - mammoth - 01-16-2010

Very nice, thanks a lot.
By the way, is there a way to prevent the buff from sticking to other characters of the same type (2 Marks, for example)? If not, I guess I'll have to pretend stealing other people's powerups is a feature :)


RE: Facing of a Buff - Alblaka - 01-16-2010

(01-16-2010, 04:54 PM)mammoth Wrote:  Very nice, thanks a lot.
By the way, is there a way to prevent the buff from sticking to other characters of the same type (2 Marks, for example)? If not, I guess I'll have to pretend stealing other people's powerups is a feature :)

Actually, i wouldn't know of any way (besides HEX) to prevent that from happening ^^


RE: Facing of a Buff - The Lost Global Mod - 01-16-2010

maybe through making two chars of the same kind.. one mark without that thingy and one with.. dunno if thats too much effort bother some hex-guy..


RE: Facing of a Buff - mammoth - 01-16-2010

A feature it is, then.