Quote: "So if I want the the HUD to update I don't need to re-get the image? Also, no the hud doesn't update in the above code... I am trying to get it working before I tell it what kind of updates to make."
You still use GET IMAGE you just don't load the blank HUD image over and over again or delete the bitmap... everything is reusable.
Quote: "In reference to hudtimer... does the "timer" command work better? I thought about using it, but I didn't know if it would pick up the total run time of the program or the time between loops."
Technically you should only update the HUD if there's a change in information (more Cash or whatever). If it's on a timer and there is no change it's a pointless waste of time to update the HUD if it's going to look exactly the same after the update. I added a timer to the following code snip to show you what a timer would look like.
Quote: "Adding the 1 as the texture flag worked great! Thanks. While I am here, any suggestion for putting info on my HUD? The text command only seems to work with strings."
To use the TEXT command with variables use the STR$() command to convert the variable to a string.
Here's an example HUD using your image (changed to a .png that's attached):
` Make sure it's 800x600 resolution
set display mode 800,600,32
` Make random number picking more random
randomize timer()
` Set the text and color
set text font "Comic Sans"
set text size 25
set text to bold
` Load the hud image (image number 1 texture flag 1)
load image "hud.png",1,1
` Create the bitmap for the hud (the same size as image number 1)
create bitmap 1,image width(1),image height(1)
` Make Cash global (so it can be used in functions)
global Cash
` Create a timer
tim=timer()
` Update the HUD first
UpdateHUD()
do
` Pick a random color
ink rgb(rnd(255),rnd(255),rnd(255)),0
` Make a random line
line rnd(screen width()),rnd(screen height()),rnd(screen width()),rnd(screen height())
` Show the HUD
paste image 3,0,450
` Check if it's time to add cash and update the display
if timer()>tim+1000 ` 1000 = 1 second
` Increase the cash
inc Cash,5
` Reset timer
tim=timer()
` Update the HUD
UpdateHUD()
endif
loop
end
function UpdateHUD()
` Change color to black for text
ink rgb(0,0,0),0
` Change to HUD bitmap
set current bitmap 1
` Clear HUD with HUD blank (using image number 1)
paste image 1,0,0
` Show current cash
center text 68,125,"$"+str$(Cash)
` Grab edited HUD image (image number 3 the same size as bitmap 1)
get image 3,0,0,bitmap width(1),bitmap height(1),1
` Go back to main view screen
set current bitmap 0
endFunction
