├── favicon.ico ├── images ├── x.png ├── logo.png ├── lose.png ├── xf.png ├── xx.png ├── xxf.png ├── xxx.png ├── xxxf.png ├── blank.gif ├── flash.png ├── ninja.png ├── score.png ├── shadow.png ├── smoke.png ├── game-over.png ├── home-mask.png ├── ico-fire.png ├── og-image.jpg ├── background.jpg ├── developing.png ├── fruit │ └── boom.png ├── heads │ ├── Goku.png │ ├── Luffy.png │ ├── Shiba.png │ ├── DogeCoin.png │ ├── Goku-1.png │ ├── Goku-2.png │ ├── Luffy-1.png │ ├── Luffy-2.png │ ├── Naruto-1.png │ ├── Naruto-2.png │ ├── Naruto.png │ ├── Pikachu.png │ ├── Saitama.png │ ├── Shiba-1.png │ ├── Shiba-2.png │ ├── Vegeta-1.png │ ├── Vegeta-2.png │ ├── Vegeta.png │ ├── mononoke.png │ ├── DogeCoin-1.png │ ├── DogeCoin-2.png │ ├── Pikachu-1.png │ ├── Pikachu-2.png │ ├── Saitama-1.png │ ├── Saitama-2.png │ ├── mononoke-1.png │ └── mononoke-2.png ├── menu │ ├── gomenu.png │ ├── playnow.png │ ├── leaderboard.png │ └── connectwallet.png ├── background-bc.jpg ├── bg-asuna-game.jpg ├── background-black.jpg ├── logo-icon-asuna.png ├── leaderboard │ ├── lead-bg.jpg │ ├── return.png │ ├── submit.png │ ├── ico-fire.png │ ├── ico-wallet.png │ ├── lead-score.png │ └── lead-title.png ├── custom.css └── index.css ├── sound ├── boom.mp3 ├── boom.ogg ├── menu.mp3 ├── menu.ogg ├── over.mp3 ├── over.ogg ├── start.mp3 ├── start.ogg ├── throw.mp3 ├── throw.ogg ├── splatter.mp3 └── splatter.ogg ├── README.md ├── score ├── cron.php ├── db.php ├── insert.php └── getdata.php ├── index.html └── scripts └── main.js /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/favicon.ico -------------------------------------------------------------------------------- /images/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/x.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/logo.png -------------------------------------------------------------------------------- /images/lose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/lose.png -------------------------------------------------------------------------------- /images/xf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/xf.png -------------------------------------------------------------------------------- /images/xx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/xx.png -------------------------------------------------------------------------------- /images/xxf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/xxf.png -------------------------------------------------------------------------------- /images/xxx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/xxx.png -------------------------------------------------------------------------------- /images/xxxf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/xxxf.png -------------------------------------------------------------------------------- /sound/boom.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/boom.mp3 -------------------------------------------------------------------------------- /sound/boom.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/boom.ogg -------------------------------------------------------------------------------- /sound/menu.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/menu.mp3 -------------------------------------------------------------------------------- /sound/menu.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/menu.ogg -------------------------------------------------------------------------------- /sound/over.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/over.mp3 -------------------------------------------------------------------------------- /sound/over.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/over.ogg -------------------------------------------------------------------------------- /sound/start.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/start.mp3 -------------------------------------------------------------------------------- /sound/start.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/start.ogg -------------------------------------------------------------------------------- /sound/throw.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/throw.mp3 -------------------------------------------------------------------------------- /sound/throw.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/throw.ogg -------------------------------------------------------------------------------- /images/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/blank.gif -------------------------------------------------------------------------------- /images/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/flash.png -------------------------------------------------------------------------------- /images/ninja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/ninja.png -------------------------------------------------------------------------------- /images/score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/score.png -------------------------------------------------------------------------------- /images/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/shadow.png -------------------------------------------------------------------------------- /images/smoke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/smoke.png -------------------------------------------------------------------------------- /images/game-over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/game-over.png -------------------------------------------------------------------------------- /images/home-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/home-mask.png -------------------------------------------------------------------------------- /images/ico-fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/ico-fire.png -------------------------------------------------------------------------------- /images/og-image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/og-image.jpg -------------------------------------------------------------------------------- /sound/splatter.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/splatter.mp3 -------------------------------------------------------------------------------- /sound/splatter.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/sound/splatter.ogg -------------------------------------------------------------------------------- /images/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/background.jpg -------------------------------------------------------------------------------- /images/developing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/developing.png -------------------------------------------------------------------------------- /images/fruit/boom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/fruit/boom.png -------------------------------------------------------------------------------- /images/heads/Goku.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Goku.png -------------------------------------------------------------------------------- /images/heads/Luffy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Luffy.png -------------------------------------------------------------------------------- /images/heads/Shiba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Shiba.png -------------------------------------------------------------------------------- /images/menu/gomenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/menu/gomenu.png -------------------------------------------------------------------------------- /images/background-bc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/background-bc.jpg -------------------------------------------------------------------------------- /images/bg-asuna-game.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/bg-asuna-game.jpg -------------------------------------------------------------------------------- /images/heads/DogeCoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/DogeCoin.png -------------------------------------------------------------------------------- /images/heads/Goku-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Goku-1.png -------------------------------------------------------------------------------- /images/heads/Goku-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Goku-2.png -------------------------------------------------------------------------------- /images/heads/Luffy-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Luffy-1.png -------------------------------------------------------------------------------- /images/heads/Luffy-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Luffy-2.png -------------------------------------------------------------------------------- /images/heads/Naruto-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Naruto-1.png -------------------------------------------------------------------------------- /images/heads/Naruto-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Naruto-2.png -------------------------------------------------------------------------------- /images/heads/Naruto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Naruto.png -------------------------------------------------------------------------------- /images/heads/Pikachu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Pikachu.png -------------------------------------------------------------------------------- /images/heads/Saitama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Saitama.png -------------------------------------------------------------------------------- /images/heads/Shiba-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Shiba-1.png -------------------------------------------------------------------------------- /images/heads/Shiba-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Shiba-2.png -------------------------------------------------------------------------------- /images/heads/Vegeta-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Vegeta-1.png -------------------------------------------------------------------------------- /images/heads/Vegeta-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Vegeta-2.png -------------------------------------------------------------------------------- /images/heads/Vegeta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Vegeta.png -------------------------------------------------------------------------------- /images/heads/mononoke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/mononoke.png -------------------------------------------------------------------------------- /images/menu/playnow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/menu/playnow.png -------------------------------------------------------------------------------- /images/background-black.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/background-black.jpg -------------------------------------------------------------------------------- /images/heads/DogeCoin-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/DogeCoin-1.png -------------------------------------------------------------------------------- /images/heads/DogeCoin-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/DogeCoin-2.png -------------------------------------------------------------------------------- /images/heads/Pikachu-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Pikachu-1.png -------------------------------------------------------------------------------- /images/heads/Pikachu-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Pikachu-2.png -------------------------------------------------------------------------------- /images/heads/Saitama-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Saitama-1.png -------------------------------------------------------------------------------- /images/heads/Saitama-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/Saitama-2.png -------------------------------------------------------------------------------- /images/heads/mononoke-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/mononoke-1.png -------------------------------------------------------------------------------- /images/heads/mononoke-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/heads/mononoke-2.png -------------------------------------------------------------------------------- /images/logo-icon-asuna.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/logo-icon-asuna.png -------------------------------------------------------------------------------- /images/menu/leaderboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/menu/leaderboard.png -------------------------------------------------------------------------------- /images/leaderboard/lead-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/lead-bg.jpg -------------------------------------------------------------------------------- /images/leaderboard/return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/return.png -------------------------------------------------------------------------------- /images/leaderboard/submit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/submit.png -------------------------------------------------------------------------------- /images/menu/connectwallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/menu/connectwallet.png -------------------------------------------------------------------------------- /images/leaderboard/ico-fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/ico-fire.png -------------------------------------------------------------------------------- /images/leaderboard/ico-wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/ico-wallet.png -------------------------------------------------------------------------------- /images/leaderboard/lead-score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/lead-score.png -------------------------------------------------------------------------------- /images/leaderboard/lead-title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkmoon810/ninja-game/HEAD/images/leaderboard/lead-title.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # asuna-ninja-webgame 2 | 3 | -------------------------------------------------------------------------------- /score/cron.php: -------------------------------------------------------------------------------- 1 | connect_errno) { 8 | printf("Connect failed: %s\n", $mysqli->connect_error); 9 | exit(); 10 | } 11 | 12 | $query = "DELETE FROM highscore"; 13 | 14 | if ($mysqli->query($query)) 15 | printf("All scores successfully deleted.\n"); 16 | 17 | /* close connection */ 18 | $mysqli->close(); 19 | ?> -------------------------------------------------------------------------------- /score/db.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /score/insert.php: -------------------------------------------------------------------------------- 1 | query("SELECT score FROM highscore WHERE name='".$_GET["name"]."' ORDER BY score DESC") ) { 13 | if($result->num_rows){ 14 | $row=$result->fetch_row(); 15 | if ($row[0]<$_GET["score"]) 16 | $mysqli->query("UPDATE highscore SET score=".$_GET["score"].", wallet='".$_GET["wallet"]."' WHERE name='".$_GET["name"]."'"); 17 | } 18 | else 19 | $mysqli->query("INSERT INTO highscore VALUES (0,'".$_GET["name"]."',".$_GET["score"].",'".$_GET["wallet"]."')"); 20 | $result->close(); 21 | } 22 | 23 | /* close connection */ 24 | $mysqli->close(); 25 | ?> -------------------------------------------------------------------------------- /score/getdata.php: -------------------------------------------------------------------------------- 1 | connect_errno) { 8 | printf("Connect failed: %s\n", $mysqli->connect_error); 9 | exit(); 10 | } 11 | 12 | $query = "SELECT name, score, wallet FROM highscore ORDER by score DESC"; 13 | 14 | if ($result = $mysqli->query($query)) { 15 | 16 | /* fetch associative array */ 17 | $i=0; 18 | while ($row = $result->fetch_assoc()) { 19 | $top3=$i<3?"top3":""; 20 | printf ("%s%s%s", 21 | $top3, $i+1, $row["name"], $row["score"], $row["wallet"]); 22 | $i++; 23 | } 24 | if($i<6){ 25 | while($i<6){ 26 | printf (""); 27 | $i++; 28 | } 29 | } 30 | /* free result set */ 31 | $result->free(); 32 | } 33 | 34 | /* close connection */ 35 | $mysqli->close(); 36 | ?> -------------------------------------------------------------------------------- /images/custom.css: -------------------------------------------------------------------------------- 1 | {include ../../system/css/reset.css} 2 | {include ../../system/css/common.css} 3 | 4 | html, body { 5 | width: 100%; 6 | height: 100%; 7 | } 8 | 9 | body { 10 | background: url("bg-asuna-game.jpg") no-repeat center center fixed; 11 | -webkit-background-size: cover; 12 | -moz-background-size: cover; 13 | -o-background-size: cover; 14 | background-size: cover; 15 | text-align: center; 16 | font-family: 'Barlow', sans-serif; 17 | font-weight: 300; 18 | } 19 | 20 | 21 | #extra, #view{ 22 | box-shadow: 1px 1px 20px 0px rgba(0,0,0,0.75); 23 | -webkit-box-shadow: 1px 1px 20px 0px rgba(0,0,0,0.75); 24 | -moz-box-shadow: 1px 1px 20px 0px rgba(0,0,0,0.75); 25 | } 26 | 27 | .logo-footer{ 28 | width: 130px; 29 | display: block; 30 | margin: 0 auto 10px auto; 31 | } 32 | 33 | @media only screen and (max-width: 540px) { 34 | .logo-footer{ 35 | width: 100px; 36 | } 37 | } 38 | 39 | h1{ 40 | color: #fff; 41 | font-family: 'PT Sans Narrow', sans-serif; 42 | font-size: 45px; 43 | font-weight: 300; 44 | margin-bottom: 0px; 45 | } 46 | 47 | h1:before{ 48 | content:url(ico-fire.png) ; 49 | position:relative; 50 | left: -7px; 51 | top: 1px; 52 | } 53 | 54 | h1:after{ 55 | content:url(ico-fire.png) ; 56 | position:relative; 57 | right: -7px; 58 | top: 2px; 59 | } 60 | 61 | @media only screen and (max-width: 540px) { 62 | h1{ 63 | font-size: 38px; 64 | } 65 | } 66 | 67 | h2{ 68 | color: #fff; 69 | font-family: 'Barlow', sans-serif; 70 | font-weight: 300; 71 | font-size: 20px; 72 | margin-top: 8px; 73 | } 74 | 75 | a{ 76 | color: #23cc95; 77 | font-size: 23px; 78 | } 79 | 80 | a:hover{ 81 | text-decoration: none; 82 | } 83 | 84 | .header { 85 | position: fixed; 86 | left: 0; 87 | top: 0; 88 | width: 100%; 89 | text-align: center; 90 | padding: 0; 91 | } 92 | 93 | .footer { 94 | position: fixed; 95 | left: 0; 96 | bottom: 0; 97 | width: 100%; 98 | text-align: center; 99 | padding: 30px 0; 100 | } 101 | 102 | .footer h3{ 103 | color: #fff; 104 | font-family: 'Barlow', sans-serif; 105 | font-weight: 300; 106 | } 107 | 108 | @media screen and (orientation:landscape) 109 | and (min-device-width: 319px) 110 | and (max-device-width: 480px) { 111 | .header, .footer{ 112 | display: none; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /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 | Asuna Token Game 26 | 27 | 28 |
29 |

Asuna Token Game

30 |

Hit the tokens heads and take care of the bombs! Good luck.

31 |
32 |
33 |
34 |

35 | 36 |
37 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
POSITIONUSERNAMESCOREWALLET
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |
1
2
3
91 |
92 | 93 |
94 |
95 |

YOUR SCORE

96 |

0

97 |
98 | 99 |
100 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /images/index.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=PT+Sans+Narrow:wght@400;700&display=swap'); 2 | 3 | html, body { 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | body { 9 | position: relative; 10 | background: #000; 11 | margin:0; 12 | touch-action: none; 13 | } 14 | 15 | #extra, #view, #menu, #leaderboard, #inputname, #gameover{ 16 | --scale: 1; 17 | position: absolute; 18 | left: 50%; 19 | top: 54%; 20 | text-align: left; 21 | background: #fff; 22 | -webkit-transform-origin: 0 0; 23 | transform-origin: 0 0; 24 | transform-box: fill-box; 25 | } 26 | 27 | @media all and (min-width:640px) and (min-height: 0px) and (max-height: 63px) { 28 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 29 | --scale: 0; 30 | } 31 | } 32 | 33 | @media all and (min-width:640px) and (min-height: 64px) and (max-height: 139px) { 34 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 35 | --scale: 0.1; 36 | } 37 | } 38 | 39 | @media all and (min-width:640px) and (min-height: 140px) and (max-height: 224px) { 40 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 41 | --scale: 0.25; 42 | } 43 | } 44 | 45 | @media all and (min-width:640px) and (min-height: 225px) and (max-height: 279px) { 46 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 47 | --scale: 0.4; 48 | } 49 | } 50 | 51 | @media all and (min-width:640px) and (min-height: 280px) and (max-height: 359px) { 52 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 53 | --scale: 0.5; 54 | } 55 | } 56 | 57 | @media all and (min-width:640px) and (min-height: 360px) and (max-height: 419px) { 58 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 59 | --scale: 0.6; 60 | } 61 | } 62 | 63 | @media all and (min-width:640px) and (min-height: 420px) and (max-height: 579px) { 64 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 65 | --scale: 0.75; 66 | } 67 | } 68 | 69 | /* Adjust for widths < 640px */ 70 | @media all and (min-width:569px) and (max-width: 639px) { 71 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 72 | --scale: 0.875; 73 | } 74 | } 75 | 76 | @media all and (min-width:481px) and (max-width: 568px) { 77 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 78 | --scale: 0.75; 79 | } 80 | } 81 | 82 | @media all and (min-width:321px) and (max-width: 480px) { 83 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 84 | --scale: 0.5; 85 | } 86 | } 87 | 88 | @media all and (min-width:256px) and (max-width: 320px) { 89 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 90 | --scale: 0.4; 91 | } 92 | } 93 | 94 | @media all and (min-width:160px) and (max-width: 255px) { 95 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 96 | --scale: 0.25; 97 | } 98 | } 99 | 100 | @media all and (min-width:64px) and (max-width: 159px) { 101 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 102 | --scale: 0.1; 103 | } 104 | } 105 | 106 | @media all and (min-width:0px) and (max-width: 63px) { 107 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 108 | --scale: 0; 109 | } 110 | } 111 | 112 | #extra, #view, #menu, #leaderboard, #inputname, #gameover { 113 | -webkit-transform: scale(var(--scale)); 114 | transform: scale(var(--scale)); 115 | width: 640px; 116 | height: 480px; 117 | margin: calc(-280px * var(--scale)) auto auto calc(-320px * var(--scale)); 118 | } 119 | 120 | em{ 121 | display: none; 122 | } 123 | 124 | #view{ 125 | display: block; 126 | background: transparent url(blank.gif) repeat 0 0; 127 | cursor: default; 128 | z-index: 20; 129 | } 130 | 131 | #extra{ 132 | background: #000; 133 | } 134 | #extra .layer{ 135 | position: absolute; 136 | left: 0; 137 | top: 0; 138 | z-index: 10; 139 | } 140 | #fork{ 141 | display: block; 142 | position: absolute; 143 | right: 0; 144 | top: 0; 145 | width: 356px; 146 | height: 92px; 147 | cursor: pointer; 148 | background-image: url(fork.gif); 149 | z-index: 0; 150 | } 151 | 152 | #desc{ 153 | width: 100%; 154 | position: absolute; 155 | left: 0; 156 | top: 50%; 157 | height: 80px; 158 | color: #ccc; 159 | line-height: 40px; 160 | margin-top: 200px; 161 | text-align: center; 162 | font-size: 14px; 163 | } 164 | 165 | #desc a{ 166 | color: #318fe1; 167 | } 168 | 169 | #browser{ 170 | font-size: 14px; 171 | line-height: 16px; 172 | } 173 | 174 | #browser .b{ 175 | color: #fff; 176 | font-weight: 700; 177 | } 178 | #inputname{ 179 | display: block; 180 | background: transparent; 181 | z-index: 902; 182 | font-family: 'PT Sans Narrow', sans-serif; 183 | font-size: 30px; 184 | color: #fff; 185 | text-align: center; 186 | } 187 | #ninjianame{ 188 | background: transparent; 189 | border: 2px solid #42a283; 190 | text-align: center; 191 | font-family: 'PT Sans Narrow', sans-serif; 192 | font-size: 28px; 193 | border-radius: 9px; 194 | color: #fff; 195 | padding: 5px 0; 196 | width: 240px; 197 | margin-top: 200px; 198 | } 199 | #ninjianame:focus{border: 2px solid #cff1e6;} 200 | #submit{ 201 | display: block; 202 | margin-top: 50px; 203 | margin-left: 224px; 204 | } 205 | #menu{ 206 | display: none; 207 | text-align: center; 208 | background: transparent; 209 | z-index: 1; 210 | } 211 | #connectwallet{ 212 | display: none; 213 | margin-top: 240px; 214 | } 215 | #playnow{ 216 | 217 | margin: 240px auto 0; 218 | } 219 | #goleader{ 220 | margin-top: 10px; 221 | } 222 | #leaderboard{ 223 | display: none; 224 | text-align: center; 225 | background: url(leaderboard/lead-bg.jpg); 226 | z-index: 901; 227 | } 228 | .lead-title{margin-top: 35px;} 229 | #lead-th,#ranking{ 230 | width: 480px; 231 | color: #fff; 232 | text-align: center; 233 | font-family: 'PT Sans Narrow', sans-serif; 234 | } 235 | #lead-th{margin-top: 10px;margin-left: 80px;} 236 | #lead-th td{font-size: 21px;} 237 | #rankBlock{margin-left:80px;width: 500px;height: 250px;overflow-y: scroll;} 238 | #ranking tr{display: block;margin: 5px;background: rgba(255,255,255,0.13);border-radius: 5px;} 239 | #ranking tr.top3{background: rgba(253,249,189,0.33);} 240 | #ranking td{height: 30px;font-size: 19px;text-shadow: 2px 2px #000000;} 241 | #ranking td.num{width: 100px;font-weight: 700;} 242 | #ranking tr.top3 td.num:before{ 243 | content: ''; 244 | display: block; 245 | position: relative; 246 | width: 17px; 247 | height: 25px; 248 | margin-left: 18px; 249 | margin-bottom: -23px; 250 | background: url(leaderboard/ico-fire.png); 251 | } 252 | #ranking td.name{width: 180px;} 253 | #ranking td.score{width: 100px;} 254 | #ranking td.wallet{width: 80px;} 255 | #ranking td.wallet a{ 256 | display: block; 257 | width: 18px; 258 | height: 18px; 259 | margin: 0 auto; 260 | background: url(leaderboard/ico-wallet.png); 261 | } 262 | #return{ 263 | display: block; 264 | margin-top: 15px; 265 | margin-left: 224px; 266 | } 267 | #gameover{ 268 | display: none; 269 | text-align: center; 270 | font-family: 'PT Sans Narrow', sans-serif; 271 | font-size: 50px; 272 | color: #fff; 273 | background: url(leaderboard/lead-bg.jpg); 274 | z-index: 903; 275 | } -------------------------------------------------------------------------------- /scripts/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | let nickname=""; 4 | let asunaToken=0; 5 | 6 | //Asuna token address 7 | let ContractAddress="0xC656B2279B0FdF761e832133B06CE607fBBcbceb"; 8 | 9 | // Etherscan API key 10 | let ApiKeyToken="FPF18WR1MIHBWYBQ13HUETMRKVXEXFN4ZK"; 11 | 12 | // Unpkg imports 13 | const {WalletLink} = require('walletlink'); 14 | const Web3Modal = window.Web3Modal.default; 15 | const WalletConnectProvider = window.WalletConnectProvider.default; 16 | const Fortmatic = window.Fortmatic; 17 | 18 | // Web3modal instance 19 | let web3Modal 20 | 21 | // Chosen wallet provider given by the dialog window 22 | let provider; 23 | 24 | // Address of the selected account 25 | let selectedAccount=""; 26 | 27 | /** 28 | * Setup the orchestra 29 | */ 30 | function init() { 31 | 32 | console.log("WalletConnectProvider is", WalletConnectProvider); 33 | console.log("Fortmatic is", Fortmatic); 34 | console.log("window.web3 is", window.web3, "window.ethereum is", window.ethereum); 35 | 36 | // Tell Web3modal what providers we have available. 37 | // Built-in web browser provider (only one can exist as a time) 38 | // like MetaMask, Brave or Opera is added automatically by Web3modal 39 | const providerOptions = { 40 | walletconnect: { 41 | package: WalletConnectProvider, 42 | options: { 43 | // Mikko's test key - don't copy as your mileage may vary 44 | infuraId: "8043bb2cf99347b1bfadfb233c5325c0", 45 | } 46 | }, 47 | 48 | fortmatic: { 49 | package: Fortmatic, 50 | options: { 51 | // Mikko's TESTNET api key 52 | key: "pk_test_887467F2DC5BBFB4" 53 | } 54 | }, 55 | 'custom-walletlink': { 56 | display: { 57 | logo: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMzgzcHgiIGhlaWdodD0iMzgzcHgiIHZpZXdCb3g9IjAgMCAzODMgMzgzIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA1NC4xICg3NjQ5MCkgLSBodHRwczovL3NrZXRjaGFwcC5jb20gLS0+CiAgICA8dGl0bGU+d2FsbGV0bGluazwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxyZWN0IGlkPSJwYXRoLTEiIHg9IjAiIHk9IjAiIHdpZHRoPSIzODMiIGhlaWdodD0iMzgzIiByeD0iNjQiPjwvcmVjdD4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjQ5Ljk5OTk5MzglIiB5MT0iMCUiIHgyPSI0OS45OTk5OTM4JSIgeTI9IjEwMCUiIGlkPSJsaW5lYXJHcmFkaWVudC0zIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzJFNjZGOCIgb2Zmc2V0PSIwJSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjMTI0QURCIiBvZmZzZXQ9IjEwMCUiPjwvc3RvcD4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IndhbGxldGxpbmsiPgogICAgICAgICAgICA8ZyBpZD0iUGF0aCI+CiAgICAgICAgICAgICAgICA8bWFzayBpZD0ibWFzay0yIiBmaWxsPSJ3aGl0ZSI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgIDwvbWFzaz4KICAgICAgICAgICAgICAgIDxyZWN0IHN0cm9rZT0iIzk3OTc5NyIgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIzODIiIGhlaWdodD0iMzgyIiByeD0iNjQiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxwb2x5Z29uIGZpbGw9InVybCgjbGluZWFyR3JhZGllbnQtMykiIGZpbGwtcnVsZT0ibm9uemVybyIgbWFzaz0idXJsKCNtYXNrLTIpIiBwb2ludHM9IjAgMCAzODMgMCAzODMgMzg0IDAgMzg0Ij48L3BvbHlnb24+CiAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPHBhdGggZD0iTTYwLjEwNzQsMTkxLjU3MiBDNjAuMTA3NCwyNjQuOTY2IDExOS42MDUsMzI0LjQ2MyAxOTIuOTk4LDMyNC40NjMgQzI2Ni4zOTIsMzI0LjQ2MyAzMjUuODg5LDI2NC45NjYgMzI1Ljg4OSwxOTEuNTcyIEMzMjUuODg5LDExOC4xNzkgMjY2LjM5Miw1OC42ODE2IDE5Mi45OTgsNTguNjgxNiBDMTE5LjYwNSw1OC42ODE2IDYwLjEwNzQsMTE4LjE3OSA2MC4xMDc0LDE5MS41NzIgWiBNMTU5LjAzNywxNDguNzUyIEMxNTQuMTQ0LDE0OC43NTIgMTUwLjE3OCwxNTIuNzE4IDE1MC4xNzgsMTU3LjYxMSBMMTUwLjE3OCwyMjUuNTMzIEMxNTAuMTc4LDIzMC40MjYgMTU0LjE0NCwyMzQuMzkzIDE1OS4wMzcsMjM0LjM5MyBMMjI2Ljk1OSwyMzQuMzkzIEMyMzEuODUyLDIzNC4zOTMgMjM1LjgxOCwyMzAuNDI2IDIzNS44MTgsMjI1LjUzMyBMMjM1LjgxOCwxNTcuNjExIEMyMzUuODE4LDE1Mi43MTggMjMxLjg1MiwxNDguNzUyIDIyNi45NTksMTQ4Ljc1MiBMMTU5LjAzNywxNDguNzUyIFoiIGlkPSJTaGFwZSIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+', 58 | name: 'Coinbase', 59 | description: 'Scan with Coinbase to connect', 60 | }, 61 | options: { 62 | appName: 'ERC721 Mint', // Your app name 63 | networkUrl: 'https://cloudflare-eth.com', 64 | chainId: 56, 65 | }, 66 | package: WalletLink, 67 | connector: async (_, options) => { 68 | const { appName, networkUrl, chainId } = options 69 | const walletLink = new WalletLink({ 70 | appName 71 | }); 72 | const provider = walletLink.makeWeb3Provider(networkUrl, chainId); 73 | await provider.enable(); 74 | return provider; 75 | }, 76 | } 77 | }; 78 | 79 | web3Modal = new Web3Modal({ 80 | cacheProvider: false, // optional 81 | providerOptions, // required 82 | disableInjectedProvider: false, // optional. For MetaMask / Brave / Opera. 83 | }); 84 | 85 | console.log("Web3Modal instance is", web3Modal); 86 | } 87 | 88 | /** 89 | * Kick in the UI action after Web3modal dialog has chosen a provider 90 | */ 91 | async function fetchAccountData() { 92 | 93 | // Get a Web3 instance for the wallet 94 | const web3 = new Web3(provider); 95 | 96 | console.log("Web3 instance is", web3); 97 | 98 | // Get connected chain id from Ethereum node 99 | const chainId = await web3.eth.getChainId(); 100 | 101 | // Get list of accounts of the connected wallet 102 | const accounts = await web3.eth.getAccounts(); 103 | 104 | selectedAccount = accounts[0]; 105 | //selectedAccount = '0x095E4e53905B74A389546653C177AdB1cCd8C7f6'; 106 | console.log("selectedAccount: ", selectedAccount) 107 | 108 | var xhttp = new XMLHttpRequest(); 109 | xhttp.onreadystatechange = function() { 110 | if (this.readyState == 4 && this.status == 200) { 111 | var data=JSON.parse(this.responseText); 112 | if(data.message=="OK"){ 113 | const balance=data.result; 114 | asunaToken = Math.floor(web3.utils.fromWei(balance, "kether")); 115 | } else { 116 | alert(data.result); 117 | } 118 | } 119 | }; 120 | xhttp.open("GET", 'https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress='+ContractAddress+'&address='+selectedAccount+'&tag=latest&apikey='+ApiKeyToken, true); 121 | xhttp.send(); 122 | 123 | document.querySelector("#connectwallet").style.display = "none"; 124 | document.querySelector("#playnow").style.display = "block"; 125 | } 126 | 127 | /** 128 | * Fetch account data for UI when 129 | * - User switches accounts in wallet 130 | * - User switches networks in wallet 131 | * - User connects wallet initially 132 | */ 133 | async function refreshAccountData() { 134 | await fetchAccountData(provider); 135 | } 136 | 137 | /** 138 | * Connect wallet button pressed. 139 | */ 140 | async function onConnect() { 141 | 142 | console.log("Opening a dialog", web3Modal); 143 | try { 144 | provider = await web3Modal.connect(); 145 | } catch(e) { 146 | console.log("Could not get a wallet connection", e); 147 | return; 148 | } 149 | 150 | // Subscribe to accounts change 151 | provider.on("accountsChanged", (accounts) => { 152 | fetchAccountData(); 153 | }); 154 | 155 | // Subscribe to chainId change 156 | provider.on("chainChanged", (chainId) => { 157 | fetchAccountData(); 158 | }); 159 | 160 | // Subscribe to networkId change 161 | provider.on("networkChanged", (networkId) => { 162 | fetchAccountData(); 163 | }); 164 | 165 | await refreshAccountData(); 166 | } 167 | 168 | function submitName(){ 169 | nickname=document.getElementById("ninjianame").value; 170 | if(nickname!=""){ 171 | document.querySelector("#menu").style.display = "block"; 172 | document.querySelector("#inputname").style.display = "none"; 173 | }else 174 | alert("INSERT A NICKNAME!!!") 175 | } 176 | function getScore(){ 177 | var xhttp = new XMLHttpRequest(); 178 | xhttp.onreadystatechange = function() { 179 | if (this.readyState == 4 && this.status == 200) { 180 | document.getElementById("ranking").innerHTML = this.responseText; 181 | } 182 | }; 183 | xhttp.open("POST", "score/getdata.php", true); 184 | xhttp.send(); 185 | 186 | document.querySelector("#leaderboard").style.display = "block"; 187 | } 188 | window.addEventListener('load', async () => { 189 | init(); 190 | 191 | // input name 192 | document.querySelector("#submit").addEventListener("click", submitName); 193 | var input = document.getElementById("ninjianame"); 194 | input.addEventListener("keyup", function(event) { 195 | if (event.keyCode === 13) { 196 | event.preventDefault(); 197 | submitName() 198 | } 199 | }); 200 | 201 | // Connect Wallet 202 | document.querySelector("#connectwallet").addEventListener("click", onConnect); 203 | 204 | // play Game 205 | document.querySelector("#playnow").addEventListener("click", function(){ 206 | if(asunaToken>=0){ 207 | document.querySelector("#menu").style.display = "none"; 208 | var sence = require("scripts/sence"); 209 | sence.switchSence( "game-body" ); 210 | } else 211 | alert("Current Asuna token is "+asunaToken+" trillion.\nAt least 250 trillion require!"); 212 | }); 213 | document.querySelector("#goleader").addEventListener("click", getScore); 214 | document.querySelector("#return").addEventListener("click", function(){ 215 | document.querySelector("#leaderboard").style.display = "none"; 216 | }); 217 | document.querySelector("#gomenu").addEventListener("click", function(){ 218 | var xhttp = new XMLHttpRequest(); 219 | xhttp.onreadystatechange = function() { 220 | if (this.readyState == 4 && this.status == 200) { 221 | console.log(this.responseText); 222 | document.querySelector("#gameover").style.display = "none"; 223 | document.querySelector("#menu").style.display = "block"; 224 | } 225 | }; 226 | xhttp.open("GET", "score/insert.php?name="+nickname+"&score="+ninjiascore+"&wallet="+selectedAccount, true); 227 | xhttp.send(); 228 | }); 229 | document.querySelector("#goleader2").addEventListener("click", function(){ 230 | var xhttp = new XMLHttpRequest(); 231 | xhttp.onreadystatechange = function() { 232 | if (this.readyState == 4 && this.status == 200) { 233 | console.log(this.responseText); 234 | getScore(); 235 | document.querySelector("#gameover").style.display = "none"; 236 | document.querySelector("#menu").style.display = "block"; 237 | } 238 | }; 239 | xhttp.open("GET", "score/insert.php?name="+nickname+"&score="+ninjiascore+"&wallet="+selectedAccount, true); 240 | xhttp.send(); 241 | }); 242 | }); 243 | --------------------------------------------------------------------------------