1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Game script

Discussion in 'PHP' started by rhoula, Nov 23, 2014.

  1. #1
    Hello

    I m looking for a php script that can manage quizzes. This is what I need done exactly.

    Let's say I have a circle made out of small dots when the player clicks on a dot he will be asked a question and will be offered 3 answers if he chooses the right answer the dot he clicked on will not be clickable no more and it will turn to another color.

    The dots are made out of small images. I was thinking about something mysql based please help or if you can guide me to the right place to look.

    Thank you :)
     
    rhoula, Nov 23, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    This is fairly simple to make, and there is no need for images (you can create the circles via CSS) - and you should use javascript (ajax) to fetch the question / answer-options and recolor the circles. It's basically maybe 100-200 lines of code. However, if you don't know anything about HTML/CSS, javascript and PHP, it's of course a challenge. However, not too hard to make, and a good project to learn what you need.
     
    PoPSiCLe, Nov 23, 2014 IP
  3. rhoula

    rhoula Well-Known Member

    Messages:
    875
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Thank you so much for taking the time to answer my question. Do you by any chance know of any script I can look at to have an idea of what i need done.
     
    rhoula, Nov 23, 2014 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Well. What you need is as follows: a php file that reads the database and returns the question / answers for a given id - the id for the button clicked. The main page should also be a php file reading all (or a random subset) of the id's from the database. Then you need some javascript pushing the id (the info from the button clicked) and showing the content returned from the backend php file. On top of that you'd need css to style the different parts. Unfortunately, I don't have any examples, but this is mostly basic functionality, and it should be possible to gather the needed info bit by bit
     
    PoPSiCLe, Nov 24, 2014 IP
  5. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #5
    ThePHPMaster, Nov 24, 2014 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Here's a simple example (hardcoded) in HTML / CSS / jQuery : http://jsfiddle.net/uqa8m9fm/
    You'll see that this is hardcoded - you'd probably want to get the content via PHP (reading the database) to be able to populate it without having to hardcode - if you'll always have the same amount of entries, you can hardcode the CSS, but the best would probably be to have a javascript-based posititioning going on, so you can add more or less as many entries as you can fit in the circle. (Base the positioning on the previous entries, and avoid overlapping, mostly). This is just a very, very basic example
     
    PoPSiCLe, Nov 24, 2014 IP
  7. rhoula

    rhoula Well-Known Member

    Messages:
    875
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    145
    #7
    Thank you so much guys for the great help. Popsicle. I like the idea behind the script you made.

    ThePhpMaster thank you for the link. I will try to download some of the script and try them up myself :)

    Have a wonderful day :)
     
    rhoula, Nov 24, 2014 IP