TGC Codebase Backup



Snow Trails by chromatic3d

21st Oct 2011 1:15
Summary

Snowy pointer tracker leaves trail of snow particles and rings bell on click. For Holiday game.



Description

Snowy pointer tracker leaves trail of snow particles and rings bell on click. For Holiday game. Not best code but looks good in 1920 x 1080.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    // Initialize Display
SetDisplayAspect( 1.66 )
ap=1

// Load Images
LoadImage( 1, "/image01.png", ap )
LoadImage( 2, "/image02.png", ap )
LoadImage( 3, "/image03.png", ap )
LoadImage( 4, "/image04.png", ap )
LoadImage( 5, "/image05.png", ap )

// Load Sounds
LoadSound( 1, "/bell01.wav" )
LoadSound( 2, "/bell02.wav" )
LoadSound( 3, "/bell03.wav" )
LoadSound( 4, "/bell04.wav" )
LoadSound( 5, "/bell05.wav" )

// Play Sound
for i = 1 to 5
    PlaySound( i, 50, 0 )
    SetSoundSystemVolume( 50 )
next i


// Set Particles
for i = 1 to 5
    CreateParticles( i, 50, 50 )
    SetParticlesImage( i, i )
    SetParticlesVisible( i, 1 )
next i

for i = 1 to 5
    SetParticlesPosition( i, 50, 50 )
    SetParticlesAngle( i, 360 )
    SetParticlesColorInterpolation( i,1 )
    AddParticlesColorKeyFrame( i, 4, 255, 255, 255, 255-i*25 )
    AddParticlesColorKeyFrame( i, 2, 255, 255, 255, 255-i*25 )
    AddParticlesColorKeyFrame( i, 1, 255, 255, 255, 255-i*25 )
    SetParticlesDepth( i, 1000 )
    SetParticlesDirection( i, 0, 6*i )
    SetParticlesFrequency( i, 100 )
    SetParticlesLife( i, 150 )
    SetParticlesMax( i, -1 )
    SetParticlesSize( i, .2 )
    SetParticlesStartZone( i, 1, 1,-1, -1 )
    SetParticlesVelocityRange( i, .1, .15 )
next i

// Main Loop
do
    Sync()
        for i =1 to 5
        xx = GetPointerX()
        yy = GetPointery()
        SetParticlesPosition( i, xx, yy )
    next i
    mp= GetPointerPressed()
    if mp > 0
        print (xx)
        pl= xx/25+1 : PlaySound( pl, 100, 0 )
        mu = GetPointerReleased()
        mh = GetPointerState()
    endif
loop