YesNoOk
avatar

Round Shadows based on SF3 (Read 9502 times)

Started by inktrebuchet, November 26, 2023, 09:16:18 pm
Share this topic:
Round Shadows based on SF3
New #1  November 26, 2023, 09:16:18 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
Info and Updates
I've put together several options for round shadows that mimic Street Fighter 3's round shadows. These were all designed to be simple copy paste use, for perfect conversion you would probably want to reference a sprite table and not a universal math formula since some of the characters in SF3 don't stick to the same rules as others.

*IKEMEN users,
This version is still compatible with any version of IKEMEN since it uses classic mugen triggers and sctrls but
Foobs has put together a really great version just for IKEMEN that you should checkout. (Only compatible with the nightly build as of April 1st, 2024)
https://github.com/RealFoobs/SF3-like-Shadows

* Two other versions that use M.U.G.E.N's actual shadow mechanics will be posted here soon.




Download SF3 Shadows sprites. I have each one set as their own animation starting at 8530 with time set to -1 for each in the air file. Pick the version you like and paste it in you characters. This code now uses explods so you can use fightfx.air now!

This goes in the characters Air file
*If you don't have a blank animation already
Code:
; Blank
[Begin Action 9741]
-1,0, 0,0, -1

This goes in [statedef -2] for players and in helpers for projectiles
*for projectiles, AssertSpecial noshadow will need to be in every state the projectile uses.
Code:
[state -2, shadow] 
type = helper
trigger1 = !numhelper(33333399+ID)
name = "shadow"
ID = 33333399+ID
stateno = 33333399
postype = p1
ownpal = 1
keyctrl = 0
supermovetime = 2147483647
pausemovetime = 2147483647
ignorehitpause = 1
[State shadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

Your pick goes in CNS or data/common1.cns
Version 1 | Scale based round shadows
[Not how it’s actually done in sf3, this has smoother size transitions and only uses one sprite(8.png in the shadows download). There are some options in the 'scale' parameter of angledraw. You can use it as default and the shadow's size will be calculated based on the width in the character's constant or you can adjust your base shadow size manually. ]
Code:
;=========================================================================
;Scale based round shadows by Inktrebuchet
;=========================================================================
[Statedef 33333399]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0, 0
anim = 9741 ; Blank Animation

[State 33333399, 1]
type = BindToParent
trigger1 = PlayerIdExist(parent,ID)
time = 1
facing = 1
pos =0,-Parent,Pos Y
ignorehitpause = 1

[State 33333399, 2]
type = RemoveExplod
trigger1 = 1
ignorehitpause = 1

[State 33333399, 3];Shadow for player
type = Explod
trigger1 = Time ;This is to correct a 1 frame delay in shadow pos when helper is first spawned
trigger1 = NumExplod(8530) = 0
trigger1 = PlayerIdExist(Parent,ID)
trigger1 = !Parent,IsHelper
id = 8530
anim = 8530
postype = p1
pos = 0,0
;scale = (.47 - (((.47/(96/cond(abs(Parent,Pos Y)+.0001 < 96, abs(Parent,pos Y)+.00001, 96)))))) + .6 + (.0) * Const(size.xscale), (.3 - ( ( (.3/(96/cond(abs(Parent,Pos Y)+.0001 < 96, abs(Parent,Pos Y)+.00001, 96)))))) + .8 + (.0) * Const(size.yscale) ;The last float number in () is to adjust base shadow size. This number should be the same for x and y. 
scale = ((.47 - (((.47/(96/cond(abs(Parent,Pos Y)+.0001 < 96, abs(Parent,pos Y)+.00001, 96)))))) + .6 )/(100.0/(Parent,Const(size.ground.back) + Parent,Const(size.ground.front))) * 2 * Const(size.xscale) ,  ((.3 - ( ( (.3/(96/cond(abs(Parent,Pos Y)+.0001 < 96, abs(Parent,Pos Y)+.00001, 96)))))) + .8)/(100.0/(Parent,Const(size.ground.back) + Parent,Const(size.ground.front))) * 2 * Const(size.yscale) ;Bases shadow size on character width
trans = addalpha
alpha =  128,128
removetime = -1
sprpriority = -4
ignorehitpause = 1

[State 33333399, 4];Shadow for projectile
type = Explod
trigger1 = Time ;This is to correct a 1 frame delay in shadow pos when helper is first spawned
trigger1 = NumExplod(8531) = 0
trigger1 = PlayerIdExist(Parent,ID)
trigger1 = Parent,IsHelper
id = 8530
anim = 8530
postype = p1
pos = 0,0
scale = (.47 - (((.47/(96/cond(abs(Parent,pos y)+.0001 < 96, abs(Parent,Pos Y)+.00001, 96)))))) + .6 + (-.3) * Const(size.xscale), (.3 - ( ( (.3/(96/cond(abs(Parent,Pos Y)+.0001 < 96, abs(Parent,Pos Y)+.00001, 96)))))) + .8 + (-.3) * Const(size.yscale) ;The last float number in () is to adjust base shadow size. This number should be the same for x and y. 
trans = addalpha
alpha =  128,128
removetime = -1
sprpriority = -4
ignorehitpause = 1

[State 33333399, 5] ;*This may need to be adjusted for some projectiles
type = RemoveExplod
trigger1 = !PlayerIdExist(parent,ID)
trigger2 = PlayerIdExist(parent,ID)
trigger2 = Parent, IsHelper
trigger2 = Parent, MoveContact
trigger2 = Parent, Movetype != A
ignorehitpause = 1

[State 33333399, 6]
type = DestroySelf
trigger1 = Time
trigger1 = !NumExplod(8530)
ignorehitpause = 1

;----------------------------

Version 2 | Sprite based round shadows
[This is the more accurate to sf3 version to use. Base shadow sprite can be changed in the 'anim' parameter of changeanim. ]
Code:
;=========================================================================
;Sprite based round shadows by Inktrebuchet
;=========================================================================
[Statedef 33333399]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0, 0
anim = 9741 ; Blank Animation

[State 33333399, 1]
type = BindToParent
trigger1 = PlayerIdExist(parent,ID)
time = 1
facing = 1
pos =0,-Parent,Pos Y
ignorehitpause = 1

[State 33333399, 2]
type = RemoveExplod
trigger1 = 1
ignorehitpause = 1

[State 33333399, 3];Shadow for projectile
type = Explod
trigger1 = Time ;This is to correct a 1 frame delay in shadow pos when helper is first spawned
trigger1 = NumExplod(8531) = 0
trigger1 = PlayerIdExist(Parent,ID)
trigger1 = !Parent,IsHelper
id = 8530
anim = 8530 + ceil(cond(abs(Parent,pos y) < 96, abs(Parent,pos y +.00001), 96) / 12)  + (7) ;The last number in () is to adjust base shadow size.
scale = Const(size.xscale), Const(size.yscale)
postype = p1
pos = 0,0
trans = addalpha
alpha =  128,128
shadow = -1
removetime = -1
sprpriority = -4
ignorehitpause = 1

[State 33333399, 4];Shadow for projectile
type = Explod
trigger1 = Time ;This is to correct a 1 frame delay in shadow pos when helper is first spawned
trigger1 = NumExplod(8531) = 0
trigger1 = PlayerIdExist(Parent,ID)
trigger1 = Parent,IsHelper
id = 8530
anim = 8550 ;Projectiles only have one shadow size in sf3
scale = Const(size.xscale), Const(size.yscale)
postype = p1
pos = 0,0
trans = addalpha
alpha =  128,128
shadow = -1
removetime = -1
sprpriority = -4
ignorehitpause = 1

[State 33333399, 5] ;*This may need to be adjusted for some projectiles
type = RemoveExplod
trigger1 = !PlayerIdExist(parent,ID)
trigger2 = PlayerIdExist(parent,ID)
trigger2 = Parent, IsHelper
trigger2 = Parent, MoveContact
trigger2 = Parent, Movetype != A
ignorehitpause = 1

[state 33333399, 6]
type = DestroySelf
trigger1 = Time
trigger1 = !NumExplod(8530)
ignorehitpause = 1

;----------------------------



Old versions you shouldn't care about because compatibility is important:
Spoiler: helper based, compatible with 1.1b stages but can't use fight.sff sprites so harder to add to all characters (click to see content)
Spoiler: no helper, only explod. no projectile support and not compatible with 1.1b stages with zoom! (click to see content)
Last Edit: April 08, 2024, 02:57:07 am by inktrebuchet
Re: Round Shadows based on SF3
#2  November 27, 2023, 12:56:17 am
  • ***
  • me
  • a guy who makes art
    • Brazil
Cool!  thanks for sharing

Re: Round Shadows based on SF3
#3  November 28, 2023, 03:05:54 am
  • ****
    • USA
    • twitter.com/inktrebuchet
These have been updated to work with 1.1b stages that have zoom. Changes to how explods work in 1.1b made it impossible to keep them as explods, mainly because explods are updated after pos y and vel y so they wouldn't be in the correct spot. Correcting that was no problem but the explod being in -2 caused the shadows to jump for one tick..

These helper version work perfectly now!
Re: Round Shadows based on SF3
#4  November 30, 2023, 03:15:31 am
  • **
  • Don't copy code if you don't understand it.
    • USA
    • a13rown@hotmail.com
Thanks for the code man.  This is exactly what I needing for my project!!!
Re: Round Shadows based on SF3
#5  November 30, 2023, 04:25:38 am
  • ****
    • USA
    • twitter.com/inktrebuchet
Gave this another update.

I realized this should use explods so the option of using animations from fightfx.air would be there. This would make it a lot easier to add to the whole roster and not need to add sprites and animations to each character. A blank animation will need to be added to every character that uses this.

All the old versions are still available to checkout at the bottom of the original post.
Last Edit: November 30, 2023, 04:30:37 am by inktrebuchet