collapse

Author Topic: BGPalFX "Fade background to black and to normal with complete control over time"  (Read 2168 times)

0 Members and 1 Guest are viewing this topic.

Offline ClubSyN-X-TReME

  • Character and Interactive Stage Specialist
  • Club Syndicate Admin
  • *
  • Posts: 1641
  • Last Login:July 28, 2014, 06:54:54 AM
    • Club SyN -X-treme
Long topic title I know but I figured I share this with those who are looking for a decent code to fade a bg to black and fade back, make the bg stay black as long as you want then fade back to normal when ready.

Normally you can do such a thing with the palfx, bgpalfx, all palfx sctrls but you can't specify the amount of time to keep a bg a solid color before changing back which will result in everything happening in 1 shot.

With this formula I developed, you will have more control of the transition fading, speed of the fading, and time period of how long to keep that solid bg color before fading back to normal.

First you need to make a helper block to call for this BGPALFX helper to spawn.

Code: [Select]
[State 0, Background fx helper]
type = helper
trigger1 = time = 0
helpertype = Normal
id = xxxx
pos = 0,0
postype = p2
name = "BGFX"
stateno = xxxx
ignorehitpause = 1
persistent = 0

Place that block in whatever state of your character where you want this effect to kick in. Adjust the trigger to your likings also.
Now we have that helper block created we need to make the states for this.

Below I have everything set up and labeled areas where you can make your modifications:

Code: [Select]
;PalFX, BGPAlF, AllPAlFX Helper states

[statedef XXXX]
type = s

[State 0, AssertSpecial];Self Explanitory
type = AssertSpecial
trigger1 = 1
flag = invisible
flag2 = noshadow

[State 0, NotHitBy];Helper can't be attacked
type = NotHitBy
trigger1 = 1
value = SCA

[State 0, Offset]; Positions helper off screen
type = Offset
trigger1 = 1
y = 99999999

[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 0
value = 256 ;leave as is

[State 0, VarAdd]
type = VarAdd
trigger1 = var(1) = 0
trigger1 = var(0) > 1;Do Not touch, this keeps the bg black after the fading!
v = 0
value = -1 ;decrease the value to speed the fade to black time, valid values are -1 through -5

[State 0, VarSet]; BG is now completely black, Do not alter this block
type = VarSet
trigger1 = var(0) < 2
v = 1
value = 1

[State 0, VarAdd]
type = VarAdd
trigger1 = var(1) = 1
trigger1 = var(0) <= 256;leave as is
trigger1 = time > 400 ;adjust to your likings, decrease or increase time variation to fade back to normal
v = 0
value = 1  ;increase the value to speed the fade to normal time, valid values are 1 through 5

[State 0, BGPalFX]
type = BGPalFX
trigger1 = var(0)
time = 1
add = 0,0,0
mul = var(0),var(0),var(0)
sinadd = 0,0,0,10
invertall = 0
color = 256

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time > 10
trigger1 = var(0) >= 256

This uses the two vars I created in the helper, (by the way that part of the code can be copied and pasted but you still have to make adjustments to match your satisfaction and helpers uses their own vars so they can be left as it), are set to play as the identifiers in the BGPalFX sctrl block. whatever changes the vars makes, the BGPalFX scrtl will read them and match the changes made. Pay attention to everything I labeled in the code for better understanding.

*Note: when adjusting the values in the varadd sctrls, values that are higher or lower that the prefered values may still work but will result in debug flooding or the entire trick not to act properly. The max allowed values should be fast enough. Also the lines XXXX, change them into numeric values and make sure they all are the same.
« Last Edit: September 08, 2010, 09:29:49 PM by ClubSyN-X-Treme.net »



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

D2TD VS Showcase Thread by D2TD
[Today at 09:12:03 AM]


Marvel vs. Capcom: Eternity of Heroes REMAKE Game Update 1.3.0 - N.A.O.H. by LightFlare
[November 21, 2024, 09:44:09 PM]


Terrordrome: Rise of the Boogeymen Extended Version ( jeepers creepers) version by leonardo
[November 19, 2024, 10:22:47 PM]


Hill of the Nameless(1.1 Only) by Vegaz by LightFlare
[November 19, 2024, 10:50:39 AM]


Golden Axe Returns by gokudo99
[November 19, 2024, 03:59:31 AM]


Barkley Shut Up and Jam! Stages by Vegaz by LightFlare
[November 12, 2024, 11:26:21 AM]


[BOR] _Avengers United Battle Force_ by O Ilusionista
[November 11, 2024, 12:35:24 PM]


Eternal Lament Stage 1.1 & 1.0 by O Ilusionista
[November 11, 2024, 12:34:54 PM]


MatreroG's Stages W.I.P. Concepts by MatreroG
[November 11, 2024, 07:00:56 AM]


Spooky House(1.1 Only/AIGS) by Vegaz by LightFlare
[October 31, 2024, 11:31:36 AM]

* IMT Calendar

November 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