Daygamer:
I made a few edits to your code as well as the main Berzerk code to make it work in-game, but nice job overall. Please take a look to see the changes I made and post any questions / comments you have.
This is the function itself:
function HighScores()
cls 0 : show mouse
`alter the text font and size for the high score menu
set text font "Agent Orange"
set text size 48
`load an image for the high score menu and place it in the center of the screen
xpos = (ScrWid - image width(HSImage) / 2)
ypos = 50
rx = (ScrWid - image width(DMImages(5) )) / 2 : ry = ScrHgt - 100
`create values to hold names and scores of the high scores
dim highscore_name$(10) as string
dim highscore_value(10) as word
dim highscore_color(10) as integer
`if the highscore file exists load data from it or else load my hard coded data
if file exist ("media\Bz.hscore") = true
open to read 1,"media\Bz.hscore"
for k = 1 to 10
read string 1,highscore_name$(k)
read word 1,highscore_value(k)
highscore_color(k) = rgb(rnd(128) + 127,rnd(128) + 127,rnd(128) + 127)
next k
close file 1
else
`hardcode some values for testing
restore HighScoreTable
for k = 1 to 10
read highscore_name$(k)
read highscore_value(k)
highscore_color(k) = rgb(rnd(128) + 127,rnd(128) + 127,rnd(128) + 127)
next k
endif
// display the high score menu
PushedExit = false
repeat
cls 0
mx = mousex() : my = mousey() : mc = mouseclick()
`text 10,100,"mx: " + str$(mx )
`text 10,120,"my: " + str$(my )
paste image HSImage,screen width() / 2 - 235,50
for k = 1 to 10
ink highscore_color(k),0
text 430,(k * 42) + 164,highscore_name$(k)
text 530,(k * 42) + 164,str$(highscore_value(k) )
next k
if mx >= 443 and mx <= 567
if my >= 668 and my <= 725
paste image DIImages(5),rx - 10,ry + 3
if mc = true then PushedExit = true
else
paste image DMImages(7),rx,ry
endif
else
paste image DMImages(7),rx,ry
endif
sync
until PushedExit = true
GameState = 0
HighScoreTable:
` player name, high score
data "YNA",654,"GEO",575,"LAE",571,"PIG",412,"SAM",398,"PIE",305
data "JON",214,"DAR",189,"NTA",124,"GSH",111
hide mouse
endfunction
Also, I couldn't get the font you had to work, so I picked another one that did. I also had it pick random colors for each score. The menu looks like this in-game:
Quote: "I'm rather inexperienced with loading data. I can't picture what kind of file we will be loading from, so I don't know how to load the highscore values from "Bz.hscore"."
You'll notice I declared the highscore arrays as a string and as a word. A string array holds characters. A word can hold up to 16 bits of data - plenty for what we need. At this point, the game has not written a game save file, but I have saved one in the updated code. You can see it done by inserting this code at the end of the HighScores() function:
open to write 1,"media\Bz.hscore"
for k = 1 to 10
write string 1,highscore_name$(k)
write word 1,highscore_value(k)
next k
close file 1
You won't notice any difference when you run it again, because the same data is displayed. To show you it is loading in the info, put a line of code, right after the ' open to read 1,"media\Bz.hscore"' code in the HighScores() function to show you:
text 100,100,"Loading data." : sync : wait 1200
When you run the game again and go into the High Score Menu, this should be displayed.
NOTE: You cannot simply plug this function into your code and have it work, as I have made other edits and have added another image, which you will need to make it work. I have updated the FTP with the new code and will update the link in the first post to include this. I have also included a 'media\Bz.hscore' file.
Quote: "But isn't the 'return to main menu' part of a bigger jpg image called 'DiffMenu.' How do I use only the 'return to main menu' button by itself?"
Good question; you are correct. I took the image off of the MainMenu image and saved it as a separate image. It is included in the updated code.
Dz:
Quote: "I havent really started with lives yet, still thinking about what I should do. I think I may just go with a select (That way when player.lives change, it automatically changes too) Though that may not work out so well, tell me what you think is the best way to go about this."
What you need to do is write a function to display the extra lives that the player has available. Since we plan to use paste image for this, it will need to be called each time from the Main game loop (where GameState = 1). In your function, look at how many lives the player has. If they have more than 1, display a man image for each additional life, up to a max of five.
Game status update:
1) [DONE] robots explode when running into walls or each other
2) [DONE] possibility of 11 robots in each room
3) scoring system and display
4) extra lives displayed
5) [DONE} player actually shoots
a) [DONE] collision with walls
b) [DONE] collision with robots
c) collision with Evil Otto
6) Evil Otto character created and animated - LBFN
a) Evil Otto in-game with collision with robots / man
7) screen scrolls when moving room to room - thisotherguy
8) final boss in room 36
a) create character
b) coding
9) [DONE] device input menu
10) [DONE] game difficulty menu
11) soundFX menu
12) [DONE] high scores menu
13) [DONE] wall tile graphics
I will plan to work on an Evil Otto character next.