rem rem AGK Application 1.08B18 rem MR 23.08.2013 Screen Wave SetDisplayAspect( 4.0/3.0 ) dim i[100] dim s[100] MainLoop() end function MainLoop() sync() spr=loadsprite("screen.png") //<- any background image setspritesize(spr,100,100) drawsprite(spr) MakeWave() deletesprite(spr) w#=0 do print("Hello Wave") print(screenfps()) DoWave(w#) w#=w#+360.0/60.0 if w#>360.0 then w#=w#-360.0 if getpointerpressed()=1 then exit Sync() loop FreeWave() endfunction function MakeWave() for y=0 to 99 i[y]=GetImage( 0, y,getvirtualwidth(), 1.0 ) s[y]=createsprite(i[y]) setspritesize(s[y],getvirtualwidth(),1.5) setspriteposition(s[y],0,y) setspritedepth(s[y],0) next endfunction function DoWave(w#) for y=0 to 99 setspriteposition(s[y],cos(w#),y+sin(w#)*4.0) w#=w#+360.0/100.0 next endfunction function FreeWave() for y=0 to 99 deletesprite(s[y]) s[y]=0 deleteimage(i[y]) i[y]=0 next endfunction
// set window properties SetWindowTitle( "sprites" ) SetWindowSize( 1024, 768, 0 ) // set display properties SetVirtualResolution( 1024, 768 ) _White = MakeColor(255,255,255) _Blue = MakeColor(0,0,175) _Yellow = MakeColor(175,175,0) _Green = MakeColor(0,175,0) _Red = MakeCOlor(175,0,0) Render() DrawEllipse(128, 128, 128, 128, _White, _White, 1) Render() blue = GetImage(0,0,128,128) Yellow = GetImage(128,0,128,128) Green = GetImage(0,128,128,128) red = GetImage(128,128,128,128) ClearScreen() _Sprite(blue, blue, 0,0,100, 0,0,175,255) _Sprite(yellow, yellow,150,0,100, 175,175,0,255) _Sprite(green, green, 300,0,100, 0,175,0,255) _Sprite(red, red, 450,0,100, 175,0,0,255) SaveImage(blue, "blue.png") SaveImage(Yellow, "yellow.png") SaveImage(Green, "green.png") SaveImage(Red, "red.png") SetClearColor(75,75,75) do print(chr(10)+chr(10)+chr(10)+"Images are Saved in the App directory.") Sync() loop function _Sprite(num, img, x#, y#, size#, Cr, Cg, Cb, Ca) CreateSprite(num, img) SetSpritePosition(num, x#, y#) SetSpriteColor(num, Cr, Cg, Cb, Ca) setSpriteSize(num, size#, size#) Endfunction