I believe this is DBC-compatable but with my limited knowledge of DBC I'm not sure.
These functions will create and animate a circle that zooms in on one point on the screen, like the "The End" sequence in many old Warner Bros. Cartoons. It's pretty hard to explain, so just download the attached image and try it out.
Special thanks to Tiresius who came up with this method
here.
Notes:
Make sure to download the attached media before running the program.
InitiateDCircle() must be called before ShrinkDCircle(Rate,X,Y) because it creates all the sprites that are needed.
InitiateDCircle() can also be used to reset the circle.
ShrinkDCircle(Rate,X,Y) must be called each loop or the circle will not continue to shrink.
- Rate is how fast the circle closes. I find 10 or 15 is a good value.
- X and Y are the X and Y positions the circle closes on.
- The command will return a 1 when the circle is as small as it will go, otherwise 0 is returned.
`Zooming Circle Transition by BmacZero
`Theory - Thanks to Tiresius
remstart
InitiateDCircle() must be called before ShrinkDCircle(Rate,X,Y) because it creates all the sprites that are needed.
InitiateDCircle() can also be used to reset the circle.
ShrinkDCircle(Rate,X,Y) must be called each loop or the circle will not continue to shrink.
- Rate is how fast the circle closes. I find 10 or 15 is a good value.
- X and Y are the X and Y positions the circle closes on.
- The command will return a 1 when the circle is as small as it will go, otherwise 0 is returned.
remend
`Basic setup - change to suit your needs
sync on : sync rate 60
color backdrop rgb(0,200,100)
`Setup Death Circles - Easy to change the sprite and image numbers to fit your program
#Constant DCircleSprite 1
#Constant DLeftBoxSprite 2
#Constant DTopBoxSprite 3
#Constant DRightBoxSprite 4
#Constant DBottomBoxSprite 5
#Constant BoxImage 1
#Constant CircleImage 2
InitiateDCircle()
do
ShrinkDCircle(10,screen width()/2,screen height()/2)
`Reset it
if spacekey()=1 then InitiateDCircle()
sync
loop
function ShrinkDCircle(Rate,XIn,YIn)
local Started as boolean
local done as boolean
if Started=0
Started=1
show sprite DCircleSprite
show sprite DLeftBoxSprite
show sprite DTopBoxSprite
show sprite DRightBoxSprite
show sprite DBottomBoxSprite
endif
if sprite scale x(DCircleSprite)>=Rate
size sprite DCircleSprite,sprite width(DCircleSprite)-Rate,sprite height(DCircleSprite)-Rate
done=0
else
size sprite DCircleSprite,0,0
done=1
endif
sprite DCircleSprite,XIn-sprite width(DCircleSprite)/2,YIn-sprite height(DCircleSprite)/2,CircleImage
paste sprite DCircleSprite,XIn-sprite width(DCircleSprite)/2,YIn-sprite height(DCircleSprite)/2
if XIn<0 then XIn=0
if YIn<0 then YIn=0
size sprite DLeftBoxSprite,XIn,screen height()
size sprite DTopBoxSprite,screen width(),YIn
paste sprite DLeftBoxSprite,0-sprite width(DCircleSprite)/2,0
paste sprite DTopBoxSprite,0,0-sprite height(DCircleSprite)/2
paste sprite DRightBoxSprite,XIn+sprite width(DCircleSprite)/2,0
paste sprite DBottomBoxSprite,0,YIn+sprite height(DCircleSprite)/2
sprite DLeftBoxSprite,0-sprite width(DCircleSprite)/2,0,BoxImage
sprite DTopBoxSprite,0,0-sprite height(DCircleSprite)/2,BoxImage
sprite DRightBoxSprite,XIn+sprite width(DCircleSprite)/2,0,BoxImage
sprite DBottomBoxSprite,0,YIn+sprite height(DCircleSprite)/2,BoxImage
endfunction done
function InitiateDCircle()
local HereAlready as boolean
if HereAlready=0
HereAlready=1
ink rgb(1,0,0),rgb(1,0,0)
box 1,1,2,2
get image BoxImage,1,1,2,2,1
load image "Circle.bmp",CircleImage,1
sprite DCircleSprite,0,0,CircleImage
endif
size sprite DCircleSprite,screen width()+512,screen width()+512
sprite DLeftBoxSprite,0,0,BoxImage
sprite DTopBoxSprite,0,0,BoxImage
sprite DRightBoxSprite,0,0,BoxImage
sprite DBottomBoxSprite,0,0,BoxImage
size sprite DRightBoxSprite,screen width(),screen height()
size sprite DBottomBoxSprite,screen width(),screen height()
hide sprite DCircleSprite
hide sprite DLeftBoxSprite
hide sprite DTopBoxSprite
hide sprite DRightBoxSprite
hide sprite DBottomBoxSprite
endfunction
Questions, comments, concerns?
Powered by Box2D Physics. Thanks Diggsey!