Right think I am getting it!!!
Just been messing with a simple level, code etc attached to just run but code also below.
I have created a simple level built into the code using the Mid command for text which seems pretty fast and so far on all devices broadcast it fills the screen correctly with not too much distortion.
Still not sure about the aspect being -1 as above yet though??
and yes those are gosub commands for now lol
// Project: Voxel Platform
// Created: Spectre
// ######################################## Set up the screen
SetSyncRate(30,0)
SetOrientationAllowed(0,0,1,1)
screenWidth# = GetMaxDeviceWidth()
screenHeight# = GetMaxDeviceHeight()
aspect# = screenWidth#/screenHeight#
SetDisplayAspect(-1)
displayLeft# = GetScreenBoundsLeft()
displayRight# = GetScreenBoundsRight()
displayTop# = GetScreenBoundsTop()
displayBottom# = GetScreenBoundsBottom()
displayWidth# = displayRight# - displayLeft#
displayHeight# = displayBottom# - displayTop#
displayCentreX# = displayWidth# * 0.5
displayCentreY# = displayHeight# * 0.5
SetScissor( displayLeft#, displayTop#, displayRight#, displayBottom# )
// ###########################################################
// ######################################## Set up pixel percentages
onePercentX# = screenWidth#/100.0
onePercentY# = screenHeight#/100.0
xPixel# = 100.0/screenWidth#
yPixel# = 100.0/screenHeight#
// ###########################################################
// ######################################## Set up joystick and buttons
joyStick = 1
joyStickSizeX# = xPixel# * 250.0
joyStickSizeY# = joyStickSizeX# * aspect#
joyStickCentreX# = joyStickSizeX# * 0.5
joyStickCentreY# = joyStickSizeY# * 0.5
AddVirtualJoystick(joyStick, 99.0 - joyStickCentreX# , 99.0 - joyStickCentreY# , joyStickSizeX#)
SetVirtualJoystickAlpha(joyStick, 60.0, 110.0)
button1 = 1
button2 = 2
buttonSizeX# = xPixel# * 150.0
buttonSizeY# = buttonSizeX# * aspect#
buttonCentreX# = buttonSizeX# * 0.5
buttonCentreY# = buttonSizeY# * 0.5
AddVirtualButton(button1, 1.0 + buttonCentreX#, 99.0 - buttonCentreY#, buttonSizeX#)
AddVirtualButton(button2, 2.0 + buttonSizeX# + buttonCentreX#, 99.0 - buttonCentreY#, buttonSizeX#)
SetVirtualButtonText(button1,"1")
SetVirtualButtonText(button2,"2")
SetVirtualButtonAlpha(button1, 110.0)
SetVirtualButtonAlpha(button2, 110.0)
// ###########################################################
// ######################################## Set up game preferences
xSpeed# = xPixel# * 4.0
ySpeed# = (screenHeight#/screenWidth#) * aspect#
Dim lvl[10,10]
// ###########################################################
// ######################################## Load media
backImage = LoadImage("0.png")
backSprite = CreateSprite(backImage)
SetSpriteSize(backSprite, 100.0, 100.0)
SetSpritePosition(backSprite, 0.0, 0.0)
blockImage = LoadImage("1.png")
//blockSprite = CreateSprite(blockImage)
blockSizeX# = xPixel# * (onePercentX# * 10)
blockSizeY# = yPixel# * (onePercentY# * 10)
xPos# = 0.0
yPos# = 0.0
gosub level_1
//SetSpriteSize(blockSprite, blockSizeX#, blockSizeY#)
//SetSpritePosition(blockSprite, xPos#, yPos#)
// ###########################################################
SetPrintColor(0,0,0)
do
//xPos# = xPos# + xSpeed#
//yPos# = xPos# * ySpeed#
//SetSpritePosition(blockSprite, xPos#, yPos#)
//gosub printSettings
Sync()
loop
printSettings:
Print ("Screen Width = " + Str(screenWidth#))
Print ("Screen Height = " + Str(screenHeight#))
Print ("Display Width = " + Str(displayWidth#))
Print ("Display Height = " + Str(displayHeight#))
Print ("Aspect = " + Str(aspect#))
Print ("Number of X pixels in 1% = " + Str(onePercentX#))
Print ("Number of Y pixels in 1% = " + Str(onePercentY#))
Print ("Size in % 1 X pixel = " + Str(xPixel#))
Print ("Size in % 1 Y pixel = " + Str(yPixel#))
Print ("JoyStick X: "+ Str(GetVirtualJoystickX(joyStick)))
Print ("JoyStick Y: "+ Str(GetVirtualJoystickY(joyStick)))
Print ("Button 1: "+ Str(GetVirtualButtonState(button1)))
Print ("Button 2: "+ Str(GetVirtualButtonState(button2)))
Print ("X Speed = " + Str(xSpeed#))
Print ("Y Speed = " + Str(ySpeed#))
Print ("FPS = " + Str(ScreenFPS()))
return
// ######################################## Levels
// 0 = Blank square
// 1 = Platform Block 1
level_1:
lvl$= "0000000000"
lvl$=lvl$ + "0000000000"
lvl$=lvl$ + "1100000000"
lvl$=lvl$ + "0000000000"
lvl$=lvl$ + "0000000000"
lvl$=lvl$ + "0000001100"
lvl$=lvl$ + "0000000000"
lvl$=lvl$ + "0011000001"
lvl$=lvl$ + "0000000011"
lvl$=lvl$ + "1111111111"
gosub build_lvl
return
build_lvl:
textPos = 0
for y = 1 to 10
for x = 1 to 10
textPos = textPos + 1
if Mid(lvl$,textPos,1) = "1"
blockSprite=CreateSprite(blockImage)
SetSpriteSize(blockSprite, blockSizeX#, blockSizeY#)
lvl[x,y]=blockSprite
SetSpritePosition( lvl[x,y], (x-1) * blockSizeX#, (y-1) * blockSizeY# )
endif
next x
next y
return
// ###########################################################