forked from rDrama/rDrama
add stalker award
parent
9199786a60
commit
dd80e984eb
|
@ -216,6 +216,7 @@
|
|||
.fa-tv:before{content:"\f26c"}
|
||||
.fa-heart:before{content:"\f004"}
|
||||
.fa-coin:before{content:"\f85c"}
|
||||
.fa-scarecrow:before{content:"\f70d"}
|
||||
|
||||
/* do not remove - fixes hand, talking, marsey-love components
|
||||
from breaking out of the comment box
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
body {
|
||||
background: #000;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
img.cursor-ghost {
|
||||
position: absolute;
|
||||
height: 28px;
|
||||
width: 28px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% auto;
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
const assets = [
|
||||
"marseyjason",
|
||||
"marseynightmare",
|
||||
"marseyhellraiser",
|
||||
"marseysaw",
|
||||
"marseyzombie2",
|
||||
"marseywerewolf",
|
||||
"marseysatangoat",
|
||||
"marseyskeleton2",
|
||||
"marseystabby",
|
||||
"marseyface",
|
||||
"marseydaemon",
|
||||
"marseygrimreaper",
|
||||
"marseycheshire4",
|
||||
"marseyaugust",
|
||||
"marseycerebrus",
|
||||
"marseyzombie",
|
||||
"marseything",
|
||||
"marseytwins",
|
||||
"marseymonstrosity",
|
||||
"marseykrampus",
|
||||
"marseybaphomet",
|
||||
"marseyfacepeel",
|
||||
"carpwitchtrans",
|
||||
"capymummy",
|
||||
"marseynotesbardfinn"
|
||||
];
|
||||
|
||||
const count = document.getElementById('stalker-count').value,
|
||||
size = 25,
|
||||
spacing = 4 - 0.05 * count,
|
||||
diameter = 20 + 0.5 * count,
|
||||
rotation = 0.04 + 0.001 * count,
|
||||
speed = 0.03 + 0.002 * count,
|
||||
offset = 10;
|
||||
|
||||
let ghosts = [],
|
||||
a = Math.round(size * diameter * 0.2),
|
||||
current = offset,
|
||||
mouse = {
|
||||
x: a + offset,
|
||||
y: a + offset
|
||||
};
|
||||
|
||||
// populate ghosts
|
||||
for (let i = 0; i < count; i++) {
|
||||
ghosts[i] = new ghost(i);
|
||||
}
|
||||
|
||||
function ghost(i) {
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.X = 0;
|
||||
this.Y = 0;
|
||||
this.img = document.createElement("img");
|
||||
this.img.id = "ghost-" + i;
|
||||
this.img.className = "cursor-ghost";
|
||||
this.img.src = `${SITE_FULL_IMAGES}/e/${assets[i]}.webp`;
|
||||
document.body.appendChild(this.img);
|
||||
}
|
||||
|
||||
function placeghost(ghost, x, y) {
|
||||
ghost.x = x;
|
||||
ghost.y = y;
|
||||
ghost.img.style.left = ghost.x + "px";
|
||||
ghost.img.style.top = ghost.y + "px";
|
||||
}
|
||||
|
||||
function makeCircle() {
|
||||
let ghost;
|
||||
current -= rotation;
|
||||
for (let i = count - 1; i > -1; --i) {
|
||||
ghost = ghosts[i];
|
||||
ghost.img.style.top =
|
||||
Math.round(ghost.y + a * Math.sin((current + i) / spacing) - 15) + "px";
|
||||
ghost.img.style.left =
|
||||
Math.round(ghost.x + a * Math.cos((current + i) / spacing)) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener("mousemove", function (e) {
|
||||
mouse.x = e.pageX;
|
||||
mouse.y = e.pageY;
|
||||
});
|
||||
|
||||
addEventListener("touchstart", function (e) {
|
||||
event.preventDefault(); // we don't want to scroll
|
||||
let touch = event.touches[0];
|
||||
mouse.x = touch.clientX;
|
||||
mouse.y = touch.clientY;
|
||||
});
|
||||
|
||||
function getRandom(min, max) {
|
||||
return Math.floor(Math.random() * (max - min + 1) + min);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
let ghost = ghosts[0];
|
||||
let prevghost = ghosts[0];
|
||||
ghost.x = ghost.X += (mouse.x - ghost.X) * speed;
|
||||
ghost.y = ghost.Y += (mouse.y - ghost.Y) * speed;
|
||||
for (let i = count - 1; i > 0; --i) {
|
||||
ghost = ghosts[i];
|
||||
prevghost = ghosts[i - 1];
|
||||
ghost.x = ghost.X += (prevghost.x - ghost.X) * speed;
|
||||
ghost.y = ghost.Y += (prevghost.y - ghost.Y) * speed;
|
||||
}
|
||||
makeCircle();
|
||||
requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
draw();
|
|
@ -237,6 +237,19 @@ AWARDS = {
|
|||
"enabled": IS_HOMOWEEN(),
|
||||
"positive": True,
|
||||
},
|
||||
"stalker": {
|
||||
"kind": "stalker",
|
||||
"title": "Stalker",
|
||||
"description": "???",
|
||||
"icon": "fas fa-scarecrow",
|
||||
"color": "text-primary",
|
||||
"price": 250,
|
||||
"deflectable": False,
|
||||
"cosmetic": True,
|
||||
"ghost": True,
|
||||
"enabled": IS_HOMOWEEN(),
|
||||
"positive": True,
|
||||
},
|
||||
"candy-corn": {
|
||||
"kind": "candy-corn",
|
||||
"title": "Candy Corn",
|
||||
|
|
|
@ -56,3 +56,9 @@
|
|||
<link rel="stylesheet" href="{{'events/homoween/css/upsidedown.css' | asset}}">
|
||||
<script defer src="{{'events/homoween/js/upsidedown.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if p.award_count("stalker", v) %}
|
||||
<link rel="stylesheet" href="{{'events/homoween/css/stalker.css' | asset}}">
|
||||
<input hidden id="stalker-count" value="{{p.award_count('stalker', v)}}"></div>
|
||||
<script defer src="{{'events/homoween/js/stalker.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue