// Project: _PlanetAndGUI
// Created: 2020-01-17
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "_PlanetAndGUI" )
SetWindowSize( 1280, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1280, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
SetCameraRange(1, .1, 10000)
//SetCameraPosition(1, 0, 0, 0)
SetCurrentDir("\sounds\")
loadsound (1, "click2.wav")
SetCurrentDir("\media\")
loadimage (1, "gui_strip.png")
loadimage (2, "SkySphere.png")
loadimage (3, "Planet_Rocky_2.jpg")
loadimage (4, "tile_spot.png")
loadimage (5, "tile_spot_highlight.png")
loadimage(6, "planet_atmosphere.png")
CreateObjectSphere(1, -5000, 20, 25) //STAR BOX
CreateObjectSphere(10, 15, 25, 35)
CreateObjectBox(11, 16.75, 16.75, 16.75)
//SetObjectVisible(1, 0)
//SetObjectVisible(10, 0)
//SetObjectVisible(11, 0)
SetObjectPosition(10, 0, 0, 0)
SetObjectLightMode(11, 1)
SetObjectLightMode(10, 1)
SetObjectLightMode(1, 0)
SetObjectTransparency(11, 1)
SetObjectColorEmissive(11, -250, -175, -105)
SetObjectImage(1, 2, 0)
SetObjectImage(10, 3, 0)
SetObjectImage(11, 6, 0)
SetGlobal3DDepth(0)
CreateSprite(1, 1) : SetSpriteDepth(1, 0) : SetSpriteShape(1, 3)
CreateSprite(4, 4) : SetSpriteDepth(4, 0) : SetSpriteShape(4, 3)
CreateSprite(5, 5) : SetSpriteDepth(5, 0) : SetSpriteShape(5, 3)
SetSpritePosition(1, -1000, 0)
SetSpriteScale(1, 30, .3)
SetSpriteScale(4, .5, .5)
SetSpriteScale(5, .5, .5)
GLOBAL GAME_STATE = 1
GLOBAL ESCAPE_KEY=27
GLOBAL ZoomLevel as float
GLOBAL mmx as float
GLOBAL mmy as float
GLOBAL rx as float
GLOBAL Obj_X as float
GLOBAL Obj_Y as float
GLOBAL sound_playing_status as integer
Obj_X = GetScreenXFrom3D(GetObjectX(10), GetObjectY(10), GetObjectZ(10))
Obj_Y = GetScreenYFrom3D(GetObjectX(10), GetObjectY(10), GetObjectZ(10))
//MoveCameraLocalX(1, -50+ZoomLevel)
SetCameraPosition(1, 0, 0, -50)
SetCameraLookAt (1, 0, 0, 0, 0)
while GAME_STATE=1
If GetRawKeyState(ESCAPE_KEY)=1 then GAME_STATE = 0
SetObjectRotation(10, 0, rx, 0)
SetObjectRotation(1, 0, -rx*.1, 0)
rx=rx+.025
DrawTileGrid()
Print(" ")
Print(GetSpriteHitTest (4, GetRawMouseX(), GetRawMouseY()))
Print("Zoom Level: "+ str(GetSpriteHitTest (4, GetRawMouseX(), GetRawMouseY())))
Print(ScreenFPS())
Sync()
endwhile
//===================================================================================//
// ================================BEGIN FUNCTIONS====================================//
//===================================================================================//
function DrawTileGrid()
tgx as integer
tgy as integer
for tgy =1 to 7
for tgx = 1 to 7
SetSpriteVisible(4, 1)
SetSpritePosition(4, (Obj_X-225)+50*tgx, (Obj_Y-225)+50*tgy)
DrawSprite(4)
if GetSpriteHitTest (4, GetRawMouseX(), GetRawMouseY())=1
SetSpritePosition(5, GetSpriteX(4),GetSpriteY(4))
SetSpriteVisible(5, 1)
// if GetSoundsPlaying(1)=0 and sound_playing_status=0
//playsound(1, 5, 0)
// sound_playing_status=1
// endif
endif
if GetSpriteHitTest (4, GetRawMouseX(), GetRawMouseY())=0
//SetSpriteVisible(5, 0)
sound_playing_status=0
endif
next tgx
next tgy
//SetSpritePosition(5, Obj_X-25, Obj_Y-25)
endfunction