Register
Hello There, Guest!


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
treasure finder :D
#1
just put it in a code reader for the coding language HTML if you need a website here you go https://repl.it/languages/web_project to do it just click on it and a hint thing will pop up at the bottom the number of clicks is 25
Code:
    <!DOCTYPE html>
    <html>
    <head>
    <head>
    
    <body>
        <h1 id = "heading">Find the Treasure!</h1>
        <img id = "map" width = 400 height = 400 src =
                "https://nostarch.com/images/treasuremap.png">
        <p id = "distance"></p>
        <script src="https://code.jquery.com/jquery-2.1.0.js"></script>
        
        <script>
        function getRandomNumber(size)
        {
            return Math.floor(Math.random() * size);
        }
        
        var width = 400;
        var height = 400;
        var treasure = {x : getRandomNumber(width),
                        y : getRandomNumber(height)};
        var clicks = 0;
        var clickLimit = 25;
        function getDistance(event, treasure)
        {
            var diffX = event.offsetX - treasure.x;
            var diffY = event.offsetY - treasure.y;
            return Math.sqrt((diffX * diffX) + (diffY * diffY));
        }
        
        function getDistanceHint(distance)
        {
            if(distance < 10)
                return "Boiling hot";
            else if (distance < 20)
                return "Really hot";
            else if (distance < 40)
                return "Hot";
            else if(distance < 80)
                return "Warm"
            else if (distance < 160)
                return "Cold";
            else if (distance , 360)
                return "Really cold";
            else
                return "Freezing"
        };
        
        function clickHandler(event)
        {
            if (clicks < clickLimit)
            {
                clicks++;
                var distance = getDistance(event, treasure);
                var distanceHint = getDistanceHint(distance);
            
                $("#distance").text(distanceHint);
            
                if (distance < 8)
                alert("Found the treasure in " + clicks + " clicks");
            }
            else
                alert("You loose sucker")
        }
        
        $("#map").click(clickHandler);
        </script>
    </body>
    </html>
deal with it Cool
http://agarioforums.net/reputation.php?uid=4075

boi i am s11zilla do not underestimate my powers 

I AM THE FREAKING LOOMINATIS ARCH RIVAL I WILL SHATTER YOU TO PIECES

dont piss me off n00b i am awesomeness i will blind you if you mess with this


Reply


Messages In This Thread
treasure finder :D - s1104874 - 07-08-2016, 07:47 PM
RE: treasure finder :D - ℱIRE - 07-08-2016, 07:48 PM
RE: treasure finder :D - s1104874 - 07-08-2016, 07:49 PM
RE: treasure finder :D - ℱIRE - 07-08-2016, 07:50 PM
RE: treasure finder :D - Doigt - 07-09-2016, 03:26 PM
RE: treasure finder :D - Squirrel - 07-09-2016, 03:53 PM
RE: treasure finder :D - Voakie - 07-09-2016, 05:53 PM
RE: treasure finder :D - Squirrel - 07-10-2016, 02:38 AM
RE: treasure finder :D - s1104874 - 07-10-2016, 02:49 AM
RE: treasure finder :D - Doigt - 07-09-2016, 06:26 PM
RE: treasure finder :D - Squirrel - 07-11-2016, 04:07 AM
RE: treasure finder :D - s1104874 - 07-09-2016, 10:57 PM
RE: treasure finder :D - Doigt - 07-10-2016, 12:02 AM
RE: treasure finder :D - s1104874 - 07-10-2016, 01:49 AM
RE: treasure finder :D - Doigt - 07-10-2016, 05:25 PM
RE: treasure finder :D - s1104874 - 07-10-2016, 06:34 PM
RE: treasure finder :D - Craw - 07-11-2016, 01:03 AM
RE: treasure finder :D - Doigt - 07-11-2016, 02:07 PM
RE: treasure finder :D - xxHappyfrownxx - 07-12-2016, 01:52 AM
RE: treasure finder :D - Craw - 07-12-2016, 01:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)