Sence you guys were wondering.
REMEMBER IM A SOAKING WET NEWBIE WITH SCRIPTING
Dim TimerInterval ' The interval at which the timer will fire, in seconds
Dim IncreaseAmount ' The amount by which to increase or decrease the trail length each time the timer fires
Dim DefaultTrailLength '
' Set the default trail length
DefaultTrailLength = 0.48
Function CreateCustomBall ( Source, BallName, Radius, Mass, Opacity )
xBAM.BallRadius = Radius
xBAM.BallMass = 8000 'DEFAULT 8000
xBAM.BallOpacity = Opacity
Dim bi
Set bi = xBAM.BallManager.CreateCustomBall(BallName)
Source.CreateBall bi.Red, bi.Green, bi.Blue, bi.BallNumber
AddDebugText "["&xBAM.BallID&"]"
Dim ball
Set ball = xBAM.BallCloseTo(Source.X, Source.Y)
Set CreateCustomBall = ball
End Function
Sub OnTimerTickIncrease()
' This subroutine is called when the timer fires
' Increase the trail length
If xBAM.Trails.Length < 10 Then ' Set a maximum trail length to prevent it from increasing indefinitely
xBAM.Trails.Length = xBAM.Trails.Length + IncreaseAmount
End If
End Sub
Sub OnTimerTickDecrease()
' This subroutine is called when the timer fires
' Decrease the trail length
If xBAM.Trails.Length > DefaultTrailLength Then
xBAM.Trails.Length = xBAM.Trails.Length - IncreaseAmount
Else
StopTimer "OnTimerTickDecrease" ' Stop the timer when the trail length reaches default length
End If
End Sub
Sub BallTrans(color As String)
Dim ballID () 'define integer
Dim ballType 'define String
Dim ballCreationInfo
Dim transformation
' Get the ID of the DefaultBall
ballID = xBAM.BallManager.GetBallID("DefaultBall")
' Define a custom ball with the specified color
Select Case color
Case "Blue"
ballType = xBAM.BallManager.DefineCustomBall(0, 0, 255, "", "", "")
xBAM.Trails.Color 0, 0, 255
Case "Red"
ballType = xBAM.BallManager.DefineCustomBall(255, 0, 0, "", "", "")
xBAM.Trails.Color 255, 0, 0
Case "Green"
ballType = xBAM.BallManager.DefineCustomBall(0, 255, 0, "", "", "")
xBAM.Trails.Color 0, 255, 0
Case Else
' If no match is found, use default color (white)
ballType = xBAM.BallManager.DefineCustomBall(255, 255, 255, "", "", "")
xBAM.Trails.Color 192, 192, 192 'if nothing matched use this rgb for default color
End Select
' Create the custom ball
ballCreationInfo = xBAM.BallManager.CreateCustomBall(ballType)
' Create a transformation to move the custom ball to the original ball's position
transformation = xBAM.CreateTransformation()
transformation.SetPosition(ballCreationInfo.Position)
' Update the DefaultBall with the custom ball's type and position
xBAM.BallManager.UpdateBall ballID, ballType
End Sub
Sub OnFireballHitTrigger1()
' This subroutine is called when the FIREball hits trigger1
' Start increasing trail length and stop decreasing it if it was decreasing before
TimerInterval = 0.1 ' Set timer interval
IncreaseAmount = 0.05 ' Set increase amount for trail length
StartTimer "OnTimerTickIncrease", TimerInterval
StopTimer "OnTimerTickDecrease"
End Sub
Sub OnFireballHitTrigger2()
' This subroutine is called when the FIREball hits trigger2
' Start decreasing trail length and stop increasing it if it was increasing before
TimerInterval = 0.1 ' Set timer interval
IncreaseAmount = 0.05 ' Set decrease amount for trail length
StartTimer "OnTimerTickDecrease", TimerInterval
StopTimer "OnTimerTickIncrease"
End Sub
' Initialize trail length for DefaultBall at start of game or when new ball is created
xBAM.Trails.Length = DefaultTrailLength
' **** Initialize the pup plug-in ****
Dim PuP_Plug_Tex
Set PuP_Plug_Tex = xBAM.Get("PuPPlugin")
If PuP_Plug_Tex Is Nothing Then
AddDebugText "PuP Plugin is missing"
Else
AddDebugText "PuP Plugin has started"
End if
custom balls and trails all in one with transformations
i have not tweaked it as Im not sure how or if it can be