TGC Codebase Backup



Mouse effect (from Flash) by Louiz ofRohr

31st Oct 2004 12:09
Summary

Mouse effect... A trail of red balls... No media required...



Description

Take a look at this, dude... Only 11 lines for the real engine... Great explications and the better, no media required... This is an effect that I found using Flash... Very easy to transfer to the DARK BASiC language :) ... No utility, but a little bit cute :/...

Louiz_OFF - Belo Horizonte, Minas gerais_ Brasil
louizoff@hotmail.com
:)



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ` >>>>>>>>>>>>>>>    LOUiZ OF8-|  <<<<<<<<<<<<<<<
` >>>>>          MOUSE EFFECT v.B1          <<<<<
` >>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<

REM ATiVA SiNCRONiZAÇÃO DA TELA COM UMA TAXA=60 [Sync on]
sync on : sync rate 60
REM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

REM CRiA UMA BOLiNHA COLORiDA RADiALMENT [A radious colored circle]
cir#=5
for cor=1 to 250 step 41
   ink RGB(cor, 0, 0),0
   circle 50, 50, cir#
   cir#=cir#-1
next cor
REM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

REM PEGA A iMAGEM NUM CAMPO DETERMiNADO EM VOLTA DA BOLA [Get image created anteriorly]
get image 1, 40, 40, 60, 60 : cls
REM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

REM AÇÕES PRiNCiPAiS REPETiDAS A LiNHA CONSTANTE [Main loop]
DO
`aumenta o número do sprite, para postar sprites diferentes (para posicionamentos atualizados) [increase sprite number]
spr=spr+1
`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

`posta o sprite [paste sprite on the mouse position]
sprite spr, mousex()-11, mousey()-11, 1
`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

`limite máximo de sprites, para atualizar a posição do primeiro [sets a limited value for the sprite number... this is the trick: when the engine sprites all sprites of the limited value, it starts updating the last sprites to the mouse position]
if spr>15 THEN spr=1
`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

`apaga o primeiro sprite, pois ele não é apagado pelo último "if" [delete the residual sprite]
if sprite exist(1)=1 THEN delete sprite 1
`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

`atualiza a tela e volta ao "DO" [update screen and returns to "DO"]
sync : LOOP
`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
REM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX