// Project: Particles Create // Created: 2015-11-19 // Jose Bravo Sanchez (Spain) // set window properties SetWindowTitle( "Particles Create" ) SetWindowSize( 1024, 768, 0 ) // set display properties SetVirtualResolution( 1024, 768 ) SetOrientationAllowed( 1, 1, 1, 1 ) setprintsize (25) SetPrintColor(255,255,255) //Variables x=250:y=450 size=12 frecuency=100 life#=10.0 angle=15 dx#=30.00:dy#= 0.00 zonex1=0: zoney1=0 zonex2=0: zoney2=0 //Create image particles swap() SetPrintSize(25) SetPrintColor(255,255,255) Print(".'-+*^<> ") render() GetImage(1,3,10,12,10) CreateSprite(1,1) GetImage(2,18,1,10,10) CreateSprite(2,2) GetImage(3,34,6,10,10) CreateSprite(3,3) GetImage(4,50,6,10,10) CreateSprite(4,4) GetImage(5,65,5,12,12) CreateSprite(5,5) GetImage(6,81,0,10,10) CreateSprite(6,6) GetImage(7,96,0,15,20) CreateSprite(7,7) GetImage(8,108,0,15,20) CreateSprite(8,8) for n=1 to 8 SetSpritePosition (n,700+(n*30),2) setspritesize (n,20,-1) next //buttons AddVirtualButton ( 1, 23, 38, 24 ) SetVirtualButtonColor(1,0,255,0) AddVirtualButton ( 2, 54, 38, 24 ) SetVirtualButtonColor(2,255,0,0) AddVirtualButton ( 3, 23, 62, 24 ) SetVirtualButtonColor(3,0,255,0) AddVirtualButton ( 4, 54, 62, 24 ) SetVirtualButtonColor(4,255,0,0) AddVirtualButton ( 5, 23, 86, 24 ) SetVirtualButtonColor(5,0,255,0) AddVirtualButton ( 6, 54, 86, 24 ) SetVirtualButtonColor(6,255,0,0) AddVirtualButton ( 7, 23, 112, 24 ) SetVirtualButtonColor(7,0,255,0) AddVirtualButton ( 8, 54, 112, 24 ) SetVirtualButtonColor(8,255,0,0) AddVirtualButton ( 9, 23, 136, 24 ) SetVirtualButtonColor(9,0,255,0) AddVirtualButton ( 10, 54, 136, 24 ) SetVirtualButtonColor(10,255,0,0) AddVirtualButton ( 11, 23, 160, 24 ) SetVirtualButtonColor(11,0,255,0) AddVirtualButton ( 12, 54, 160, 24 ) SetVirtualButtonColor(12,255,0,0) // create a block of particles and set properties CreateParticles ( 1, 0, 0 ) SetParticlesImage ( 1, 1 ) SetParticlesPosition (1,x,y) //SetParticlesStartZone ( 1, x, y, zonex, zoney ) SetParticlesStartZone ( 1, 0, 0, 0, 0 ) SetParticlesDirection ( 1, dx#, dy# ) SetParticlesLife ( 1, life# ) SetParticlesSize ( 1, size ) SetParticlesAngle ( 1, angle ) SetParticlesFrequency ( 1, frecuency ) SetParticlesVelocityRange ( 1, 1, 4 ) AddParticlesColorKeyFrame ( 1, 0, 255, 255, 255, 255 ) AddParticlesColorKeyFrame ( 1, 3.0, 255, 255, 0, 255 ) AddParticlesColorKeyFrame ( 1, 6.0, 255, 0, 0, 255 ) AddParticlesColorKeyFrame ( 1, 9.0, 0, 0, 0, 0 ) // main loop do curx= GetPointerX ( ) cury= GetPointerY ( ) //position WASD if GetJoystickX ( )=1 then inc x,1 if GetJoystickX ( )=-1 then dec x,1 if GetJoystickY ( )=1 then inc y,1 if GetJoystickY ( )=-1 then dec y,1 SetParticlesPosition( 1, x, y ) //direction if GetVirtualButtonState ( 1 ) then inc dx#,0.10 if GetVirtualButtonState ( 2 ) then dec dx#,0.10 if GetVirtualButtonState ( 3 ) then inc dy#,0.10 if GetVirtualButtonState ( 4 ) then dec dy#,0.10 SetParticlesDirection( 1, dx#, dy# ) //size if GetVirtualButtonState ( 5 ) then inc size,1 if GetVirtualButtonState ( 6 ) then dec size,1:if size<0 then size=0 SetParticlesSize ( 1, size ) //frecuency if GetVirtualButtonState ( 7 ) then inc frecuency,1 if GetVirtualButtonState ( 8 ) then dec frecuency,1: if frecuency<0 then frecuency=0 SetParticlesFrequency ( 1, frecuency ) //life if GetVirtualButtonState ( 9 ) then inc life#,0.1 if GetVirtualButtonState ( 10 ) then dec life#,0.1:if life#<0 then life#=0 SetParticlesLife ( 1, life# ) //angle if GetVirtualButtonState ( 11 ) then inc angle,1 if GetVirtualButtonState ( 12 ) then dec angle,1:if angle<0 then angle=0 SetParticlesAngle ( 1, angle ) //StartZone if ( GetPointerPressed ( ) = 1 ) if GetSpriteHit ( GetPointerX ( ), GetPointerY ( ) ) SetParticlesImage ( 1, GetSpriteHit ( GetPointerX ( ), GetPointerY ( ) ) ) else zonex1= GetPointerX ( ) zoney1= GetPointerY ( ) repeat zonex2 = GetPointerX ( ) zoney2 = GetPointerY ( ) DrawBox (zonex1, zoney1, zonex2, zoney2, 200, 200, 200, 200, 0) dzx=(zonex2-zonex1)/2:dzy=(zoney2-zoney1)/2 SetParticlesPosition (1,zonex1+dzx,zoney1+dzy) SetParticlesStartZone ( 1, -dzx, -dzy, dzx, dzy) sync() gosub _cordenadas: until ( GetPointerPressed ( ) = 1 ) x=zonex1+dzx y=zoney1+dzy sync() endif endif //datos en pantalla Printc ("AWSD Position> X:"): Printc (x ):Printc (" Y:" ):Printc (y ) :Print (" Select Particles") Printc (" + - " ):Printc ("Direction X: " ):Print (dx# ): Printc (" + - "):Printc ("Direction Y: " ):Print (dy# ) Printc (" + - "):Printc ("Size: " ):Print (size) Printc (" + - "):Printc ("Frecuency: " ): Print (frecuency) Printc (" + - "):Printc ("Life: " ): Print (life#) Printc (" + - "):Printc ("Angle: " ):Print (angle) Printc ("StarZoneX:"): Printc (dzx*2 ):Printc (" Y:" ):Print (dzy*2) Printc ("CurX:"): Printc (curx ):Printc (" CurY:" ):Print (cury ) DrawBox (436, 1, 980, 30, 2000, 2000, 200, 200, 0) // update the screen Sync ( ) loop _cordenadas: Print ("STARTZONE") Printc (" " ):Printc ("Cor Sup X: " ):Print (zonex1 ): Printc (" " ):Printc ("Cor Sup Y: " ):Print (zoney1 ) Printc (" " ):Printc ("Cor Inf X: " ):Print (zonex2) Printc (" " ):Printc ("Cor Inf Y: " ):Print (zoney2) return