Something I made on my first night using AppGameKit Studio. Not really a game, but I just wanted to start learning the syntax etc. It only goes one way and I could make it go both ways, but maybe I'll do that later. Change variables to adjust number of stars, parallax layers, etc. A speed of less than 1 doesn't seem to work for some reason. Not sure why yet.
// Project: Super Parallax Star Scroller
// Created: 19-09-03
// By Les Duffy | lesduffy@gmail.com
// show all errors
SetErrorMode(2)
// Some custom variables
Screenx = 1920 //Width of screen
Screeny = 1080 // Height of screen
MoveSpeed = 1 // Movement Speed
StarSize = 1 // Size of stars (or blocks)
Stars = 500 // number of stars
NumLayers = 4 // number of parallax layers
// set window properties
SetWindowTitle( "Super Parallax Star Scroller" )
SetWindowSize( Screenx, Screeny, 1 ) // 1 = full screen
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( Screenx, Screeny ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // Set maximum FPS
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
// Arrays to hold stars coordinates
Dim xpos[Stars]
Dim ypos[Stars]
// Generate random positions for stars
For i = 1 to Stars
xpos[i] = Random (1,Screenx)
ypos[i] = Random (1,Screeny)
next i
Do
For x = 1 to NumLayers
white = MakeColor( 255, 255, 255, 255/x) // define the color white, with transparency
for i = (x-1) to Stars/NumLayers * x
DrawBox(xpos[i],ypos[i],xpos[i]+StarSize,ypos[i]+StarSize, white, white, white, white, 1)
xpos[i] = xpos[i] + -MoveSpeed
if xpos[i] < -StarSize
xpos[i] = Screenx
endif
next i
Next x
Sync()
Loop