forked from noops-challenge/hexbot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
66 lines (60 loc) · 2.71 KB
/
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
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser-arcade-physics.min.js"></script>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@leereilly">
<meta name="twitter:creator" content="@leereilly">
<meta name="twitter:title" content="Noops Screensaver">
<meta name="twitter:description" content="Like the ol' DVD screensaver from yesteryear. But with Noops.">
<meta name="twitter:image" content="https://leereilly.net/noops-screensaver/social-card.png">
<meta name="og:url" content="https://leereilly.net/noops-screensaver/" />
<meta name="og:type" content="website" />
<meta name="og:title" content="Noops Screensaver" />
<meta name="og:description" content="Like the ol' DVD screensaver from yesteryear. But with Noops." />
<meta name="og:image" content="https://leereilly.net/noops-screensaver/social-card.png" />
</head>
<body bgcolor="#000000">
<style>
canvas {display : block; margin : auto;}
body {color: white; text-align: center; font-family: Consolas, monaco, monospace}
a {color: white;}
</style>
<script>
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'arcade',
},
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
/* Hardcoded Hexbot API response. See https://github.com/noops-challenge/hexbot#note-to-developers. */
function randomHex() {
const hexMax = 256 * 256 * 256;
return '#' + Math.floor(Math.random() * hexMax).toString(16).toUpperCase().padStart(6, '0');
}
function preload () {
this.load.image('noops', 'noops.png');
}
function create () {
randomColor = randomHex()
this.cameras.main.setBackgroundColor(randomColor)
var noops = this.physics.add.image(Math.floor(Math.random() * 799), Math.floor(Math.random() * 599), 'noops');
noops.tint = Math.random() * 0xffffff;
noops.setVelocity(100, 200);
noops.setBounce(1, 1);
noops.setCollideWorldBounds(true);
}
</script>
<h1>Noops Screensaver</h1>
<p>A useless response to the <a href="https://noopschallenge.com/challenges/hexbot">Hexbot Challenge</a>. Inspired by the <a href="https://www.youtube.com/watch?v=m8NAlDOCG6g">DVD screensaver</a>.
<p><strong>How to play: </strong>mash that browser refresh button 🤣</p>
<p><sup>Source: <a href="https://github.com/leereilly/noops-screensaver">https://github.com/leereilly/noops-screensaver</a></sup></p>
</body>
</html>