The function is treating the variables SPRITE_SPLASH & IMAGE SPLASH as local to the function and therefore have values of 0.
You need to specifically declare the variables with the 'global' command i.e.
global SPRITE_SPLASH = 1
Alternatively pass the values to the function, or use a subroutine instead of a function.
Tested & all the rest works
` --- Initialize the screen
If Check Display Mode( 1024, 768, 16 ) = 1
Set Display Mode 1024, 768, 16
EndIf
Sync On
Sync Rate 60
Hide Mouse
` --- Set up the font and camera
Set Text Font "arial"
Set Text Size 16
Set Text To Bold
Set Text Transparent
Set Camera Range 1, 10000
` --- Give the images and sprites symbolic constants
global IMAGE_FOGGY_METAL = 1
global IMAGE_CUBEMAP = 2
global IMAGE_SPLASH = 3
global SPRITE_SPLASH = 1
` --- Give the meshes symbolic constants
MESH_ZAPPER = 1
` --- Define basic constants
GAME_STATE_SPLASH = 1
GAME_STATE_RESTART = 2
` --- Declare some basic variables
GameState = GAME_STATE_SPLASH
` --- Load all the resources and media
Sync
Center Text Screen Width() / 2, Screen Height() / 2, "Loading... Please Wait"
Sync
Load Image "Resources\Textures\Foggy Metal.tga", IMAGE_FOGGY_METAL
Load Image "Resources\Textures\Cubemap.dds", IMAGE_CUBEMAP
Load Image "Resources\Textures\Splash.tga", IMAGE_SPLASH
Load Image "Splash.tga", IMAGE_SPLASH
Load Object "Resources\Meshes\Zapper.x", MESH_ZAPPER
` --- Main game loop
Do
` --- Process current game state
If GameState = GAME_STATE_SPLASH Then ProcessGameStateSplash()
If GameState = GAME_STATE_RESTART Then ProcessGameStateRestart()
` --- Sync the screen once every frame
Sync
Loop
` --- Define all functions and subs
Function ProcessGameStateSplash()
Sprite SPRITE_SPLASH, 0, 0, IMAGE_SPLASH
If ReturnKey() = 1 Then GameState = GAME_STATE_RESTART
EndFunction
Function ProcessGameStateRestart()
EndFunction
Twynklet