App Game Kit: Músicas e Som
// Project: TestandoSom
// Created: 2020-06-08
SetWindowTitle( "TestandoSom" )
SetWindowSize( 1024, 768, 0 )
SetVirtualResolution ( 320, 480 )
LoadImage ( 1, "particula.png" )
CreateParticles ( 1, -100, -100 )
// carregar o arquivo de som
som = LoadSound ( "Big_Explosion_Cut_Off.wav" )
// Carrega a musica para o slot 1
LoadMusic ( 1, "Komorebi.mp3" )
// toca a musica e coloca em loop
PlayMusic( 1, 1 )
fogo = 1
do
Print ( "Clique para ativar o som da explosao" )
// se clicar o mouse toca o som de explosao
if GetPointerPressed ( ) = 1
PlaySound ( som )
explosao(fogo)
endif
Sync()
loop
function explosao(fogo)
if ( fogo = 1 )
SetParticlesPosition ( 1, Random ( 100, 200 ), Random ( 100, 300 ) )
ResetParticleCount ( 1 )
SetParticlesFrequency ( 1, 250 )
SetParticlesLife ( 1, 3.0 )
SetParticlesSize ( 1, 64 )
SetParticlesStartZone ( 1, -10, 0, 10, 0 )
SetParticlesImage ( 1, 1 )
SetParticlesDirection ( 1, 10, 10 )
SetParticlesAngle ( 1, 360 )
SetParticlesVelocityRange ( 1, 0.8, 2.5 )
SetParticlesMax ( 1, 500 )
AddParticlesColorKeyFrame ( 1, 0.0, 0, 0, 0, 0 )
AddParticlesColorKeyFrame ( 1, 0.5, 255, 255, 0, 255 )
AddParticlesColorKeyFrame ( 1, 2.8, 255, 0, 0, 0 )
AddParticlesForce ( 1, 2.0, 2.8, 25, -25 )
fogo = 0
endif
if ( GetParticlesMaxReached ( 1 ) )
fogo = 1
endif
endfunction
Comentários
Postar um comentário