📅  最后修改于: 2023-12-03 15:20:09.189000             🧑  作者: Mango
Skeld is a popular map in the game Among Us, and it contains several common tasks that players need to perform to complete different objectives. As a programmer, you may want to know more about these tasks so that you can develop the necessary skills to create similar mini-games or challenges for your projects.
This task requires players to connect colored cords to their corresponding outlets. It involves pattern recognition and hand-eye coordination. Here is a code snippet that simulates this task:
### Wiring Task
#### Objective
Connect each colored cord to its matching plug.
#### Instructions
1. Click on a cord to pick it up.
2. Click on an outlet to connect the cord.
3. Repeat until all cords are connected.
#### Code Snippet
const cords = ["red", "yellow", "blue", "green"]; // randomized array const outlets = cords.sort(); // sorted array const playerCords = []; // empty array
function connectCords(playerCord) {
if (outlets.includes(playerCord)) {
playerCords.push(playerCord);
console.log(${playerCord} is connected.
);
} else {
console.log(Wrong outlet.
);
}
}
for (const cord of cords) { connectCords(cord); }
This task requires players to swipe a card through a card reader at a steady speed. It involves manual dexterity and timing. Here is a code snippet that simulates this task:
### Card Swipe Task
#### Objective
Swipe the card through the card reader smoothly.
#### Instructions
1. Click and drag the card to the reader.
2. Release the mouse button at the right time.
#### Code Snippet
const cardWidth = 10; // in centimeters let speed = 100; // in pixels per second let startTime = 0; // in milliseconds let endTime = 0; // in milliseconds let completed = false;
function startSwipe() { startTime = new Date().getTime(); }
function endSwipe() {
if (!completed) {
endTime = new Date().getTime();
const elapsed = endTime - startTime;
const distance = cardWidth * 10; // in pixels
const time = elapsed / 1000; // in seconds
const speed = distance / time;
console.log(Swipe speed: ${speed.toFixed(2)} px/s
);
completed = true;
}
}
This task requires players to restore the oxygen level in different rooms by activating valves within a limited time. It involves strategy and time management. Here is a code snippet that simulates this task:
### Oxygen Depletion Task
#### Objective
Activate all valves within the time limit to restore oxygen.
#### Instructions
1. Click on a valve to activate it.
2. Keep track of the remaining time and activate all valves before the time runs out.
#### Code Snippet
const valves = [ { name: "O2-1", activated: false }, { name: "O2-2", activated: false }, { name: "O2-3", activated: false }, { name: "O2-4", activated: false } ]; // randomized array const timeLimit = 30; // in seconds let remainingTime = timeLimit; // in seconds
function activateValve(valveIndex) {
valves[valveIndex].activated = true;
console.log(${valves[valveIndex].name} activated.
);
}
function deactivateValve(valveIndex) {
valves[valveIndex].activated = false;
console.log(${valves[valveIndex].name} deactivated.
);
}
setInterval(() => {
remainingTime--;
console.log(Time left: ${remainingTime}s
);
if (remainingTime === 0) { console.log("Time's up!"); return; }
if (valves.every((valve) => valve.activated)) { console.log("Oxygen fully restored!"); return; }
const randomIndex = Math.floor(Math.random() * valves.length); const randomValve = valves[randomIndex];
if (!randomValve.activated) { activateValve(randomIndex); } else { deactivateValve(randomIndex); } }, 1000);
These are some of the common tasks on Skeld that can be fun and challenging for players. As a programmer, you can use the problem-solving logic in these tasks to create similar mini-games or challenges that suit your project requirements.