Global iplayer:TImage = LoadImageSafe("Sprites\player.png") Function LoadImageSafe:TImage(File:String,Flags:Int=MIPMAPPEDIMAGE|FILTEREDIMAGE) Local image:TImage=LoadImage(File,Flags) If image=Null Then Print "Failed to load " +File+ "!" Return image End Function
Don't use absolute file paths (C:\Space Invaders\Sprites\player.png), use relative paths (Sprites\player.png). They're relative of where the main BMX file is that you compile.
To keep your code organized and to prevent stupid little errors, look up Strict or SuperStrict. They'll help.
And for reptitive things like your loading images that also checks for errors, its best to use a function for that (as illustrated above)