08-04-2022, 03:00 PM
(This post was last modified: 08-04-2022, 03:11 PM by TempodiBasic.)
Hi Pete
thanks
yes I'm looking that BLUE is a 0 value (so it appears as BLACK)
the same White, LightWhite, LightBlue...
in the while Vertical exploding has a rectagular box in the middle that gives 0 changeY so I introduce a corrector or Horizontal and Vertical exploding.
So in the future development for parametric sizing of boxes/blocks to move and for speeds calculations it will be adaptable.
More different effect of fading are coming... just the time to code them!
thanks
yes I'm looking that BLUE is a 0 value (so it appears as BLACK)
the same White, LightWhite, LightBlue...
in the while Vertical exploding has a rectagular box in the middle that gives 0 changeY so I introduce a corrector or Horizontal and Vertical exploding.
So in the future development for parametric sizing of boxes/blocks to move and for speeds calculations it will be adaptable.
More different effect of fading are coming... just the time to code them!
Code: (Select All)
Const Classic = 0, MoveUpLeft = 1, MoveUpRight = 2, MoveDownLeft = 3, MoveDownRight = 4, Horizontal = 5, Vertical = 6
Screen _NewImage(1280, 720, 32)
$Color:32
Dim Shared f As Long
f = _LoadFont("courbd.ttf", 128, "monospace")
testExplosion Red, Green, Violet, Classic
testExplosion Violet, Yellow, Cyan, MoveUpLeft
testExplosion Brown, Green, Black, MoveUpRight
testExplosion Gray, Brown, Green, MoveDownRight
testExplosion LightGreen, Red, Yellow, MoveDownLeft
testExplosion Gray, Brown, Cyan, Horizontal
testExplosion Red, Green, Pink, Vertical
_Font 8
Print "FINISHED!!"
End
Sub testExplosion (ForeC, BackC, LineC, ModeE)
Cls , 0
_Font f
Color ForeC, BackC
_PrintString (284, 200), "Steve is"
_PrintString (284, 328), "Awesome!"
Line (283, 199)-(645, 457), LineC, B
Sleep
Explode2 284, 200, 644, 456, 16, 16, ModeE
Sleep 2
End Sub
Sub Explode2 (x1, y1, x2, y2, pw, ph, mode)
' this copy screen visible
tempScreen = _NewImage(_Width, _Height, 32)
_PutImage , 0, tempScreen
' this calculates width, height, maxbox-X, maxbox-Y, center of area passed for exploding
w = x2 - x1 + 1: h = y2 - y1 + 1 ' width and height of image
ax = 2 * w \ pw + 1: ay = 2 * h \ ph + 1 'mAX horyzontal blocks and mA(X)Y vertical blocks
cx = x1 + w \ 2: cy = y1 + h \ 2 ' center of image
Type box
x As Single
y As Single
handle As Long
rotation As Single
changex As Single
changey As Single
End Type
Dim Array(0 To ax, 0 To ay) As box ' two dimensional array for blocks of image to explode
' this save each box/block of image into array and with the relative images
For x = 0 To ax
For y = 0 To ay
Array(x, y).handle = _NewImage(pw, ph, 32)
Array(x, y).x = x1 + pw * x
Array(x, y).y = y1 + ph * y
_PutImage , 0, Array(x, y).handle, (x1 + pw * x, y1 + ph * y)-Step(pw, ph)
Next
Next
' this moves block/boxes for getting animation of explosion
Do
Cls , 0
finished = -1
For x = 0 To ax
For y = 0 To ay
If mode = 0 Then
Array(x, y).changex = -(cx - Array(x, y).x) / 10
Array(x, y).changey = -(cy - Array(x, y).y) / 10
ElseIf mode = 1 Then
Array(x, y).changex = -cx / 10
Array(x, y).changey = -cy / 10
ElseIf mode = 2 Then
Array(x, y).changex = cx / 10
Array(x, y).changey = -cy / 10
ElseIf mode = 3 Then
Array(x, y).changex = -cx / 10
Array(x, y).changey = cy / 10
ElseIf mode = 4 Then
Array(x, y).changex = cx / 10
Array(x, y).changey = cy / 10
ElseIf mode = 5 Then
Array(x, y).changex = -(cx - Array(x, y).x) / 10
If Array(x, y).changex = 0 Then Array(x, y).changex = -10
Array(x, y).changey = 0
ElseIf mode = 6 Then
Array(x, y).changex = 0
Array(x, y).changey = -(cy - Array(x, y).y) / 10
If Array(x, y).changey = 0 Then Array(x, y).changey = -10
End If
Array(x, y).x = Array(x, y).x + Array(x, y).changex
Array(x, y).y = Array(x, y).y + Array(x, y).changey
If Array(x, y).x >= 0 And Array(x, y).y >= 0 And _
Array(x, y).x <= _Width And Array(x, y).y <= _Height Then finished = 0
_PutImage (Array(x, y).x, Array(x, y).y)-Step(pw, ph), Array(x, y).handle, 0, (0, 0)-(pw, ph)
Next
Next
_Display
_Limit 60
Loop Until finished
_AutoDisplay
End Sub