Test

Discussion in 'Offtopic' started by hansi132, Nov 29, 2014.

  1. hansi132

    hansi132 Well-Known Member

    Messages:
    370
    Likes Received:
    114
    Local Time:
    3:58 AM
    Code:
    <!DOCTYPE html>
    <html>
    
    <body>
    <script>
    
    confirm("Are you ready to play!")
    var age = prompt("What's your age")
    if(age < 13)
    {
    	confirm("you are allowed to play but i do not take any responsibility")
    }
    else
    {
    	confirm("Good luck on your adventure")
    }
    confirm("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'")
    confirm("Suddenly, Bieber stops and says, 'Who wants to race me?'"
    )
    var userAnswer = prompt("Do you want to race Bieber on stage?")
    if(userAnswer === "yes")
    {
    	confirm("You and Bieber start racing. It's neck and neck! You win by a shoelace!")
    }
    else
    { confirm("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")
    }
    var feedback = prompt("Rate the game from 0-10")
    if(feedback >= 8)
    {
    	confirm("Thank you! We should race at the next concert")
    }
    else
    {
    	confirm("I'll keep practicing coding and racing.")
    }
    </script>
    </body>
    </html>

    Copy that into Tryit Editor v2.2 (delete the stuff that is there from the start)

    And try out my little game. nothing major but a little fun project i had :)
     
    Last edited by a moderator: Nov 29, 2014
  2. Slind

    Slind Founder

    Messages:
    8,332
    Likes Received:
    3,018
    Local Time:
    3:58 AM
  3. hansi132

    hansi132 Well-Known Member

    Messages:
    370
    Likes Received:
    114
    Local Time:
    3:58 AM
    Dident find a program i could do that in so i just made it inro an html, edited it to confirm on all the stuff too :)
     
  4. paulnator2112

    paulnator2112 Member

    Messages:
    898
    Likes Received:
    102
    Local Time:
    3:58 AM
    If you enter "Yes" instead of "yes" it will go directly to the else. Working on a fix atm (will edit jsfiddle link in here later)
     
  5. Slind

    Slind Founder

    Messages:
    8,332
    Likes Received:
    3,018
    Local Time:
    3:58 AM
    Code:
    if(userAnswer.toLowerCase() == "yes")
     
  6. paulnator2112

    paulnator2112 Member

    Messages:
    898
    Likes Received:
    102
    Local Time:
    3:58 AM
    I also fix some other things ;)

    EDIT:
    Here it goes:
    Edit fiddle - JSFiddle
    It even automatically starts from the beginning if you enter a false value.
    EDIT2:
    It now automatically starts at the chapter you entered the false value.
     
    Last edited: Nov 30, 2014
  7. hansi132

    hansi132 Well-Known Member

    Messages:
    370
    Likes Received:
    114
    Local Time:
    3:58 AM
    Fancy :) Well it is my first program i have ever coded so alot needed some improvements, also the game story isent the best but it is what CodeCademy asked me to do so i had to do it that way. Fun thing to fiddle around with for a while tough! :)

    And thanks paul for helping me with the code :)
     
  8. paulnator2112

    paulnator2112 Member

    Messages:
    898
    Likes Received:
    102
    Local Time:
    3:58 AM
    your welcome :) I can code quite alot. (LUA PHP, JS (only a bit), Java (only a bit either), Perl, Python) If you are ever in need of anything ask :p
     
  9. hansi132

    hansi132 Well-Known Member

    Messages:
    370
    Likes Received:
    114
    Local Time:
    3:58 AM
    I will :) Just noticed that CodeCademy had python too so i might look into that a bit too. Will post some creations here for you and others too look at and improve :)
     
  10. paulnator2112

    paulnator2112 Member

    Messages:
    898
    Likes Received:
    102
    Local Time:
    3:58 AM
  11. Mijikai

    Mijikai Well-Known Member

    Messages:
    1,537
    Likes Received:
    466
    Local Time:
    2:58 AM
    Why did I just race Justin bieber what

    (#Offtopic)
     
  12. paulnator2112

    paulnator2112 Member

    Messages:
    898
    Likes Received:
    102
    Local Time:
    3:58 AM
    Because you can :p
     
    Mijikai likes this.
  13. Lawmonark

    Lawmonark Well-Known Member

    Messages:
    2,558
    Likes Received:
    770
    Local Time:
    3:58 AM
    to let her win.... haven't you ever heard the saying "i wont beat a girl"
     
    hansi132 likes this.
  14. paulnator2112

    paulnator2112 Member

    Messages:
    898
    Likes Received:
    102
    Local Time:
    3:58 AM

Share This Page