It does finish but takes longer than expected and never expected little tiny bitty message in red in top left corner. What Pete said! ;-))
This explains what happened visually by making something invisible, visible, I think?
This explains what happened visually by making something invisible, visible, I think?
Code: (Select All)
Option _Explicit
Screen _NewImage(1280, 700, 32)
$Color:32
Dim As Long f
f = _LoadFont("courbd.ttf", 128, "monospace")
_Font f
Color Red, White
_PrintString (284, 200), "Steve is" '284 - 644
_PrintString (284, 328), "Awesome!"
Sleep
_Font 8
Explode 284, 200, 644, 456, 16, 16
Print "FINISHED!!"
Sub Explode (x1, y1, x2, y2, pw, ph)
Dim As Long finished, tempscreen
Dim w, h, ax, ay, cx, cy, x, y
tempscreen = _NewImage(_Width, _Height, 32)
_PutImage , 0, tempscreen
w = x2 - x1 + 1: h = y2 - y1 + 1
ax = 2 * w \ pw + 1: ay = 2 * h \ ph + 1
cx = x1 + w \ 2: cy = y1 + h \ 2
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
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)
Array(x, y).changex = -(cx - Array(x, y).x) / 10
Array(x, y).changey = -(cy - Array(x, y).y) / 10
Next
Next
Do
Cls , 0
finished = 1
For x = 0 To ax
For y = 0 To ay
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) Then
If Array(x, y).x <= _Width And Array(x, y).y <= _Height Then
finished = 0
End If
End If
_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
b = b + ...