|
Menu Puzzeler! Displaying 1-5 of 5 total.
1
jesusfreak
|
I am working on a Menu for my newest game Time Warp Z, I Am hoping to put in a menu system for buying things.. Everything was going good until I made this prob...
**you select Potion and Buy it on the Menu**
//here is the code \\
+=+=+=+=+=+=+=+=+======++++====
Case 0: HP=(hp+10); GP=(GP-50); UnPress(1);While(1){GotoXY(200, 50); PrintString(0, "Bought Potion"); ShowPage(); UpdateControls(); UnPress(1);}
//**//**//**//**\\**\\**\\**\\**\\
What I want to do is make the string that notifies the player that they bought the potion to stay there until they press ENTER.. But it does nothing.. is there another way to do this??
...D...0.......T...H...E......D...E...W...
( hey look @ my new site!!)
Posted on 2001-01-03 02:34:01
|
Devlyn
|
Several errors here. Note the bold parts
HP=(hp+10);
GP=(GP-50);
UnPress(1);
While(!b1)
/*(enter is button 1, not key scanode 1)*/
{
GotoXY(200, 50);
PrintString(0, "Bought Potion");
ShowPage();
UpdateControls();
/* UnPress(1); Unpressing a key just before it's checked whether it's pressed results in an infinite loop. Therefore I've thrown it within comment tags.*/
}
That should work, though better constructions are definately possible. Note that the map and entities are not shown because you didn't use a Render(); in the beginning of the script.
-Devlyn ( http://theshiningsource.cjb.net )
"I'm not dumb, I merely suffer from periodical intellect."
Posted on 2001-01-03 04:56:20
|
grenideer
|
You need to check for stuff to make sure that you don't go above max hp and that you have enough gold to buy the potion (ie, don't go below 0 gold). The easiest way to do this is to make a function that basically adds the stuff for you so you can still add/subtract hp in one easy line.
Alternatively, especially with gold, you can say:
If (gold=50)
{
gold=gold-50;
AddHp(1,10); //an example, character1, adding 10 hp
Notice("Bought potion!"};
}
Else { Notice("You don't have enough money"); }
See how much cleaner everything looks when you make your own functions to do small tasks? This way you don't need to rewrite all that unpress/while code because you can put it in Notice and use it whenever you want.
Posted on 2001-01-03 15:46:07
|
andy
|
! *nt™*
'Never confuse a single defeat with a final defeat.' -F. Scott Fitzgerald
Posted on 2001-01-03 17:40:33
|
jesusfreak
|
.
...D...0.......T...H...E......D...E...W...
( hey look @ my new site!!)
Posted on 2001-01-03 17:41:00
|
Displaying 1-5 of 5 total.
1
|
|