Jump to content

Recommended Posts

Hello everyone and thanks for reading my request for help ::)

 

I am working on a basic game where 3 - 5 images will be displayed on each page for the user to see (there should be about 5 pages), each of these images will have a value e.g. -1, +1, 0, -10, +12. When the user clicks on an image his/her score will change and the next page with 3 - 5 new images will be shown. When all of the pages have been shown and the user has a score of lets just say 20 or more then more pages will be displayed, if not then a new page will display stating that the game is over.

 

 

My question is how do I give each image a value and how do I show a new set of images based on the overall "score" of the player after the first set of pages have been shown?

And is there a way to display the players score on the page?

 

Thanks and any answers will be appreciated. :)

If you know of any videos which may help please tell me :)

:-\

Link to comment
https://forums.phpfreaks.com/topic/290296-picture-game-help/
Share on other sites

My question is how do I give each image a value...

 

You could have some sort of database (or array) which contains all of the images. Each image will need an unique ID and point value. When displaying the 3 to 5 images from the database, each image would be surrounded with an anchor tag that includes the image's ID. For example:

<ul>
     <li><a href="yourscript.php?imageID=1><img src="/images/image1.jpg"></a></li>
     <li><a href="yourscript.php?imageID=2><img src="/images/image2.jpg"></a></li>
     ...
</ul>

Once an image is clicked, you can use $_GET['imageID'] to see which image was clicked. The ID would be used to query the database to get the point value associated with the clicked image.

Link to comment
https://forums.phpfreaks.com/topic/290296-picture-game-help/#findComment-1486988
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.