Jump to content

frenz_hilpur

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by frenz_hilpur

  1. X-Posted several places. Alright, so I'm gonna be trying to make my first PHP game. For my first project I will attempt to duplicate the popular "higher/lower" strategy/chance game. I know how to make the number displayed random: <?php print rand(0, 25) ; ?> But I don't know how to make the input buttons to choose "higher" and "lower" I know I have to make an If...Else... loop but I'm not sure how it works. I'm very new to PHP, so could someone help me out? (If you're not familiar with this game join nutrinopets.com and go to their games section...it's a pretty simple and intuitive game actually) So basically....they generate two random numbers between one and twenty-five. The first one is shown to you, the other one you can't see until the next page. (it's really a one-page self-redirecting script) You have to guess if the secret number is lower or higher than the number they show you, by clicking a "higher" or "lower" button. Then, depending on whether you get it right or wrong, you either get a message saying something like "You won! Do you want to keep playing?(with a link to re-start)" or "You lose. Play again?(again, a link to re-start)" It's a bit more complicated than that because you have a "pot," when you win you store money in it and it builds up the more times you win, and when you lose it gets emptied. But I can add that part later. Right now I'm interested in the basic structure of the game. Here's what someone else told me. Script analysis: STEP 1 -choose a random number between 1-14(1...10, jack, queen, king, ace) (I was going to use 1-25 but maybe a real card-based format would be good, so I'll change it) -create a form with 2 hidden fields(call one card and set it to your random number and call one action and set it to higher) and a submit button (http://www.w3schools.com/html/html_forms.asp) -> don't forget the method your using is post - do the same for lower Now, honestly, I have NO idea how to do that. I mean, I understand the logic but I don't know the first piece of code to write. I'd appreciate it ever so muchly if I could get help on this. Like I said, I'm a complete PHP noob.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.