2019-02-13 19:16:01

Hi! I have the following problem: This code actually works, but when i try to choose the help option in the main menu, it won't wait me to press keys. Also i have some questions: how can i create an option to save a game so people don't have to start over each time? How can i create a thing like this: For example, if the user presses the right arrow, then the score would increase by one point? How can i create unlockables. For example, if the users attack is above 200 he/she unlocks a new weapon? Regards: Marco

Best regards: Marco

2019-02-13 20:55:58

These are general programming questions. With out getting into deep game design and programming patterns, most of these could be basic variable saving and if conditionals.

if (player.score > 200)
{
    doAchievement();
}

if (getInput.key("rightarrow"))
{
    player.score++;
}

this is not bgt, I do not know bgt, just trying to give you options.

if you want to dig deeper into game programming patterns go here
an achievements system is a whole bigger thing than a bunch of if / else if / else statements. this would not be scalable to even a few achievements. the above link talks about this idea.

I don’t believe in fighting unnecessarily.  But if something is worth fighting for, then its always a fight worth winning.
check me out on Twitter and on GitHub

2019-02-14 14:12:38

yes, you could have

 if(key_pressed(KEY_Right) 
{
score+=1;
}
else if(player.attack==200) 
{
achieveloop();
}

That, might, work, but, you know, you gotta do the extra stuff.
Also, you wanted help with your menu, paist the code:
The forum might not accept the code, so put left bracket code right bracket in front of the code, and left bracket /code right bracket, aftet your done with it so that the forum knows you are doing code.

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2019-02-14 14:26:21

Also, saving game data will require some system to save data to a file and another system to read and parse that data back out.


A file might look something like this:
save.dat (the .dat extension won't matter. It's just a text file. You can use .gsv or anything you want.)


name=Stephen
high_score=1,000
number_of_games_played=4


...And so on.


Then you'd have to read that file back into the program and split each line back into appropriate variables by the equals '=' sign.


That's just a simple method. In most published game projects you'll also want to explore ways to encrypt your game data so people can't cheat and such. But that's a whole other topic. Just get the basics working for now.


Get real familiar with the BGT help file. It has examples of everything the language is capable of and a fairly robust tutorial to get you started. It's the first resource you should be going to. Google should be the next. Plenty of people have already asked questions like that and there are plenty of answers already available. Keep your search query short and as simple as possible: "BGT saving files," "bgt splitting strings," "bgt opening files," "programming saving game data," etc.

***
You can follow me on twitter @s_luttrell and an almost never used Facebook account at skluttrell.