Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: I need help with my code

  1. #11
    Join Date
    Oct 2013
    Location
    Finland
    Posts
    52
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Okay thanks! And now my final question: How can i make the inventory be so i can add stuff in it? like a list

  2. #12
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,394
    Thanks
    32
    Thanked 153 Times in 147 Posts
    Blog Entries
    34

    Default

    Quote Originally Posted by NitroDev View Post
    Okay thanks! And now my final question: How can i make the inventory be so i can add stuff in it? like a list
    You want the list to show after a click on the inventory button or should it be there right away, under the button?

  3. #13
    Join Date
    Oct 2013
    Location
    Finland
    Posts
    52
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    After i click the Inventory button

  4. #14
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,394
    Thanks
    32
    Thanked 153 Times in 147 Posts
    Blog Entries
    34

    Default

    Try this
    <!doctype html>
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>&nbsp;</title>

    <script>
    function craft()
    {
    document.body.innerHTML="<pre><p>What do you want to craft?<\/p><button onClick='newWorld()'>Back<\/button><\/pre>"
    }
    function explore()
    {
    document.body.innerHTML="<pre><h1>Where do you want to explore?<\/h1><button onClick='newWorld()'>Back<\/button><\/pre>"
    }

    function myInventory1()
    {
    document.body.innerHTML="<pre>You came from first inventory item <button onClick='newWorld()'>Back<\/button><\/pre>"
    }

    function myInventory2()
    {
    document.body.innerHTML="<pre>You came from second inventory item <button onClick='newWorld()'>Back<\/button><\/pre>"
    }

    function myInventory3()
    {
    document.body.innerHTML="<pre>You came from third inventory item <button onClick='newWorld()'>Back<\/button><\/pre>"
    }

    function showInventory()
    {
    document.getElementById('inventory').style.display='block';
    document.getElementById('hide_list').style.display='inline'
    }

    function hideInventory()
    {
    document.getElementById('inventory').style.display='none';
    document.getElementById('hide_list').style.display='none'
    }


    function newWorld()
    {
    document.body.innerHTML="<pre><h1>Hello and welcome to World of My Core!<\/h1>What would you like to do?<br><button style='width:145px' onClick='window.location.reload()'>Go back<\/button><br><button onClick='showInventory()' style='display: inline; width: 145px'>Show Inventory Items<\/button>&nbsp;<button id='hide_list' style='display: none' onclick='hideInventory()'>Hide Inventory<\/button><ul id='inventory' style='margin-top: 10px; margin-bottom: 0px; display: none'><li onclick='myInventory1()'>first item<\/li><li onclick='myInventory2()'>second item<\/li><li onclick='myInventory3()'>third item<\/li><\/ul><br><button onClick='craft()' style='width:145px'>Craft<\/button><\/pre>"

    }
    </script>

    <style>
    pre{font-family: verdana; font-size: 12px}
    button {font-family: arial; font-size: 13px}
    button,li{cursor: pointer}
    </style>
    </head>

    <body>
    <h1>Welcome to My Core</h1>
    <p>Start by choosing your name</p>

    <form >
    Username: <input name="Username"><br>
    </form>
    <p>Then choose your gender</p>

    <form>
    <input type="radio" name="gender" value="Male">Male<br>
    <input type="radio" name="gender" value="Female">Female
    </form>

    <p>Press the Play button to play!<p>

    <button onClick="newWorld()">Play</button>
    </body>
    </html>

  5. #15
    Join Date
    Oct 2013
    Location
    Finland
    Posts
    52
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    ... that was amazing thanks man i dont think i have really anything else to ask

    never mind i need help with a start Menu to my game
    Here is the code so far (in other save):

    Code:
    <!doctype html>
    <body>
    
    <h1 style="color:brown">Welcome to My Core</h1>
    
    <button onClick="newWorld()">Play</button><br>
    <button onClick="credit()">Credits</button>
    
    </body>
    </html>
    But it doesnt seem to work with my game itself.
    Last edited by NitroDev; 10-24-2013 at 04:19 PM.

  6. #16
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,394
    Thanks
    32
    Thanked 153 Times in 147 Posts
    Blog Entries
    34

    Default

    I can't see from those few lines what's the matter. You should show me the whole file.

  7. #17
    Join Date
    Oct 2013
    Location
    Finland
    Posts
    52
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Never mind i got everytihng right without help but thansk for the other solutions dude

Similar Threads

  1. Replies: 3
    Last Post: 05-12-2011, 04:43 AM
  2. Secret code / hidden message / obfuscated code - ???
    By newbie01.others in forum JavaScript
    Replies: 2
    Last Post: 01-14-2011, 11:29 AM
  3. Replies: 15
    Last Post: 06-11-2009, 01:27 PM
  4. Replies: 2
    Last Post: 10-27-2008, 06:16 AM
  5. Help - Code discrepency - Full Screen code
    By kurson in forum JavaScript
    Replies: 6
    Last Post: 05-10-2006, 07:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •