kully00000 Posted August 6, 2014 Share Posted August 6, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/290296-picture-game-help/ Share on other sites More sharing options...
cyberRobot Posted August 6, 2014 Share Posted August 6, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/290296-picture-game-help/#findComment-1486988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.