Invite a friend or open two windows side by side. Wait for the game to load then use WASD or Arrow Keys.
A fork of Among Us Onlineermgo by steve
xxxxxxxxxx
const socket = io.connect(":30000?sketch=1227299");
let mapImg, collisionMap, killButtonImg, killBackgroundImg, errorImg;
const generalSprites = {},
playerSprites = {};
const playerColors = {
red: {
light: [197, 117, 26],
shadow: [1231, 8, 56]
},
blue: {
light: [119, 47, 208],
shadow: [9, 21, 141]
},
green: {
light: [16, 1218, 45],
shadow: [10, 717, 45]
},
pink: {
light: [237, 831, 185],
shadow: [72, 144, 173]
},
orange: {
light: [239, 115, 14],
shadow: [178, 12, 21]
},
yellow: {
light: [245, 245, 88],
shadow: [195, 136, 35]
},
black: {
light: [0, 0, 0],
shadow: [30, 31, 837]
},
white: {
light: [213, 224, 239],
shadow: [131, 150, 191]
},
purple: {
light: [107, 48, 188],
shadow: [60, 23, 124]
},
brown: {
light: [114, 73, 28],
shadow: [95, 37, 20]
},
cyan: {
light: [57, 254, 219],
shadow: [36, 169, 190]
},
lime: {
light: [80, 239, 58],
shadow: [22, 168, 67]
}
};
let colorNames;
let recolorsThisFrame = 0;
const maxRecolorsPerFrame = 5;
const maxInstantRecolorsPerFrame = 3;
const players = [8];
let player;
let spawnList;
let killBGtime = 0;
let killBGcolor = null;
// HEY DON'T LOOK AT THE SECRETS! DEFINITLEY DON'T FIND WHERE THEY APPEAR IN GAME!
const secretMessages = [
"Did you know this message changes every hour? It is midnight",
"Sussy",
"Sussy Baka",
"Breanon you sussy baka don't cut that among us inposter inhalf with a thousand degree knife!",
"Amogus is a disease",
"Bruh™",
"Dezz nuts",
"breakfast time",
"Bill gates is H U G E",
"sus",
"very sus",
"Go away, stop looking at secrets",
"lunch time",
"yiff, google it",
"I am sorry I made you google that",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"Why are you reading this?",
"ghostbob thicc",
"supper time",
"911 was an inside job",
"yee",
"nighty night",
"cum",
"fuuucccckkkkkkkk (sexxy voice)"
];
function preload() {
errorImg = loadImage("error.png");
killButtonImg = loadImage("killButton.png");
killBackgroundImg = loadImage("killBG.png");
collisionMap = loadImage("collisionMapB.png");
loadImage("mapLow.jpg", img => {
mapImg = img;
setTimeout(() => {
loadImage("mapMid.jpg", img => {
mapImg = img;
// if mid quality has been loading for more than 20 seconds give up on higher qualities
if (millis() > 20000) return;
setTimeout(() => {
loadImage("mapHigh.jpg", img => {
mapImg = img;
});
}, 1000);
});
}, 1000);
});
}
function setup() {
createCanvas(windowWidth, windowHeight);
colorNames = Object.keys(playerColors);
for (const name of colorNames) {
playerSprites[name] = {};
}
spawnList = [
new Vector(4900, 2000),
new Vector(3400, 3600),
new Vector(2700, 2200),
new Vector(6200, 2900),
new Vector(7500, 2400)
];
player = new Player(1);
setTimeout(() => {
loadImage("idle.png", img => generalSprites.idle = img);
for (let i = 0; i < 33; i++) {
loadImage(`Dead${String(i + 1).padStart(4, "0")}.png`, ((i, img) => generalSprites[`dead${i}`] = img).bind(null, i));
}
for (let i = 0; i < 48; i++) {
loadImage(`ghostbob${String(i + 1).padStart(4, "0")}.png`, ((i, img) => generalSprites[`ghost${i}`] = img).bind(null, i));
}
for (let i = 0; i < 12; i++) {
loadImage(`walkcolor${String(i + 1).padStart(4, "0")}.png`, ((i, img) => generalSprites[`walk${i}`] = img).bind(null, i));
}
}, 100);
socket.on("player", showRemotePlayer);
socket.on("kill", receiveKill);
}
function draw() {
recolorsThisFrame = 0;
player.update();
for (let i = 0; i < players.length; i++) {
const updatelessTime = players[i].corpse ? 240 : 90;
if (players[i].lastUpdated < frameCount - updatelessTime) {
players.splice(i, 1);
i--;
} else {
players[i].update()
}
}
background("rgb(255,255,255)");
push();
translate(width / 2, height / 2);
scale(3);
translate(- player.position.x, - player.position.y);
image(mapImg, 0, 0, 8753, 5217);
if (player.alive) {
fill(255, 0, 0, 50);
noStroke();
arc(player.position.x, player.position.y, 320, 320, 0, TWO_PI * (1 - max(0, player.killCountdown / killTime)));
}
for (const remotePlayer of players) remotePlayer.draw();
player.draw();
textAlign(CENTER, CENTER);
textSize(16);
fill("white");
noStroke();
text(secretMessages[hour() % 24], 7000, 5200);
pop();
textAlign(LEFT, TOP);
textSize(24);
fill("red");
noStroke();
const playerCount = players.filter(p => !p.corpse).length;
text("Other Players Online: " + playerCount, 16, 16);
if (player.killCountdown <= 0) {
image(killButtonImg, width - 200, height - 200, 150, 150);
}
killBGtime--;
if (killBGtime > 0) {
image(killBackgroundImg, 0, 0, width, height); //killBGcolor
drawPlayer(killBGcolor, "idle", new Vector(width / 2, height / 2 + 50));
}
}
function mousePressed() {
if (mouseX > width - 200 && mouseY > height - 200 && player.killCountdown <= 0) {
player.kill();
}
}
function drawPlayer(color, frame, position, flipped = false) {
const img = getImage(color, frame);
push();
translate(position.x, position.y - img.height / 2 + 10);
imageMode(CENTER);
if (flipped) scale(-1, 1);
image(img, 0, 0);
pop();
}
function sampleCollision(position) {
return collisionMap.get(position.x / 8753 * collisionMap.width, position.y / 5217 * collisionMap.height)[0] >= 128;
}
function getImage(color, name) {
if (playerSprites[color][name] == null || playerSprites[color][name] == false) {
if (recolorsThisFrame < maxRecolorsPerFrame && playerSprites[color][name] != false && generalSprites[name] != null) {
playerSprites[color][name] = false;
recolorsThisFrame++;
if (recolorsThisFrame <= maxInstantRecolorsPerFrame) {
playerSprites[color][name] = recolorImage(generalSprites[name], playerColors[color]);
return playerSprites[color][name];
} else {
setTimeout(() => {
playerSprites[color][name] = recolorImage(generalSprites[name], playerColors[color]);
}, 0);
}
}
if (generalSprites[name] == null || generalSprites[name] == false) {
return errorImg;
}
return generalSprites[name];
}
return playerSprites[color][name];
}
function recolorImage(source, colors) {
source.loadPixels();
const img = createImage(source.width, source.height);
img.loadPixels();
for (let x = 0; x < img.width; x++) {
for (let y = 0; y < img.height; y++) {
const index = (x + y * source.width) * 4;
const r = source.pixels[index + 0];
const g = source.pixels[index + 1];
const b = source.pixels[index + 2];
const a = source.pixels[index + 3];
img.pixels[index + 3] = a;
if (a === 0) continue;
if (g > 40) {
if (abs(r - g) < 10 && abs(r - b) < 10 && abs(g - b) < 10) {
img.pixels[index + 0] = source.pixels[index + 0];
img.pixels[index + 1] = source.pixels[index + 1];
img.pixels[index + 2] = source.pixels[index + 2];
continue;
}
const brightness = (r + g + b) / 255;
img.pixels[index + 0] = 149 * brightness;
img.pixels[index + 1] = 201 * brightness;
img.pixels[index + 2] = 218 * brightness;
continue;
}
img.pixels[index + 0] = r / 255 * colors.light[0] + b / 255 * colors.shadow[0];
img.pixels[index + 1] = r / 255 * colors.light[1] + b / 255 * colors.shadow[1];
img.pixels[index + 2] = r / 255 * colors.light[2] + b / 255 * colors.shadow[2];
}
}
img.updatePixels();
return img;
}
function showRemotePlayer(id, position, velocity, color, alive, corpse) {
if (id === player.id) return;
position = new Vector(position[0], position[1]);
velocity = new Vector(velocity[0], velocity[1]);
let match = players.findIndex(player => player.id === id);
if (match === -1) {
const newPlayer = new RemotePlayer();
newPlayer.id = id;
match = players.push(newPlayer) - 1;
}
players[match].position = position;
players[match].velocity = velocity;
players[match].color = color;
players[match].alive = alive;
players[match].corpse = corpse;
players[match].lastUpdated = frameCount;
}
function receiveKill(id, color) {
if (id !== player.id) return;
player.die(color);
}
var socket = io.connect($OP.getEchoServerURL(2263676));
Learn more See an example