repl.it
@mwilki7/

Canvas Basketball

HTML, CSS, JS

Play some hoops on HTML 5 Canvas

fork
loading
Files
  • index.html
  • materials
  • sound
  • src
  • style.css
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
    <meta name="viewport" content="width=device-width, initial-scale=0.5,maximum-scale=1.0, user-scalable=0">
<head>
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <title>Canvas Basketball</title>

    <style>
        body, html
        {
            background-color: darkslategray;
        }

    </style>
</head>

<body>
    <script src="src/menuaction.js"     ></script>
    <script src="src/menuitem.js"       ></script> 
    <script src="src/menu.js"           ></script>-
    <script src="src/basketball_func.js"></script>
    <script src="src/entity.js"         ></script>
    <script src="src/player.js"         ></script>
    <script src="src/attractor.js"      ></script>
    <script src="src/puck.js"           ></script>
    <script src="src/wall.js"           ></script>
    <script src="src/trigger.js"        ></script>
    <script src="src/goal.js"           ></script>
    <script src="src/scoreboard.js"     ></script>
    <script src="src/portal.js"         ></script>
    <script src="src/particle.js"       ></script>

    <div class="w3-row-padding">
        <div class="w3-third">
            <div style="width: 50%;" id="divLeft" align="center">
                <button id="button" onclick="togglefastshooty()" ontouchstart="togglefastshooty()">PRESS F FOR FAST SHOOTY</button>
            <button id="button2" onclick="togglewalls()" ontouchstart="togglewalls()">PRESS W FOR WALLS</button>
            </div>
        </div>
    </div>
    <div class="w3-row-padding">
        <div class="w3-third">
            <div id="divCenter" style="padding: 5px;">
                <canvas id="myCanvas" crossOrigin="anonymous" style="display: flex;margin: 0 auto;border: 3px solid black;" width="600" height="600">
            Canvas not supported by your browser
                </canvas>
                <button id="button" onclick="reset()" ontouchstart="reset()">Clear balls</button>
                <div style="color:white;">
                Canvas Basketball by Michael, Press S to shoot, Space to jump
                </div>
            </div>
        </div>
    </div>
</body>

</html>
result
console