Among Us Človeče: Rozdiel medzi revíziami
Z SensorWiki
(→Figúrky - 3D tlač) |
(→Používané technológie) |
||
(96 medziľahlých úprav od rovnakého používateľa nie je zobrazených.) | |||
Riadok 12: | Riadok 12: | ||
► Pritom musia figúrky raz obísť všetky polia, bez toho, aby ju súper nevyhodil. | ► Pritom musia figúrky raz obísť všetky polia, bez toho, aby ju súper nevyhodil. | ||
− | ► Počet prejdených polí sa určí hodom očíslovanej kocky. | + | ► Počet prejdených polí sa určí hodom očíslovanej kocky. |
+ | |||
+ | == Používané technológie == | ||
+ | |||
+ | === Figúrky │ 3D tlač === | ||
+ | |||
+ | |||
+ | Najprv sme museli navrhnúť herné figúrky. Na to sme použili OPENSCAD. | ||
+ | |||
+ | Potom sme chceli, aby každá herná figúrka bola jedinečná pre 4 hráčov, preto sme navrhli 4 rôzne typy klobúkov, ktoré sme umiestnili na základný model. | ||
+ | |||
+ | Potom sme išli do fablabu a vytlačili sme ich v rôznych farbách. | ||
+ | |||
+ | |||
+ | [[Súbor:Amongus3DAll.jpg|1000px|left]] | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === Herná plocha │ Laser === | ||
+ | |||
+ | ► Plocha je z dreva | ||
+ | |||
+ | ► Hernú plochu sme vyrezali s laserom | ||
+ | |||
+ | ► Hracie polia sú gravírované | ||
+ | |||
+ | |||
+ | [[Súbor:AmongusBoardSvg.png|400px|thumb|left|Doska v Inkscape]][[Súbor:AmongusBoard.jpg|400px|thumb|center|Dokončená doska]] | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === Kocka │ Elektronika === | ||
+ | |||
+ | Rozhodli sa vytvoriť digitálnu kocku so zvukovými efektmi. | ||
+ | |||
+ | Použité komponenty: | ||
+ | |||
+ | ► Arduino UNO | ||
+ | |||
+ | ► 6 segment display | ||
+ | |||
+ | ► Gombík | ||
+ | |||
+ | ► Buzzer | ||
+ | |||
+ | ► Resistor 330Ω | ||
+ | |||
+ | [[Súbor:ArduinoIRL.jpg|400px|left]] | ||
+ | [[Súbor:ArduinoSim.png|400px|left]] | ||
+ | |||
+ | <youtube width=1800 | ||
+ | | height=720>mLjCMxaiDbM</youtube> | ||
− | |||
− | |||
− | |||
− | |||
− | == | + | <tab name="Digital Dice"><source lang="c++" style="background: LightYellow;"> |
− | + | // Constants for the 7-segment display pins | |
+ | const int segmentPins[] = {2, 3, 4, 5, 6, 7, 8}; | ||
− | + | // Button pin | |
+ | const int buttonPin = 9; | ||
− | + | // Variables | |
+ | int randomNumber = 0; | ||
+ | bool buttonPressed = false; | ||
− | + | void setup() { | |
+ | // Set the 7-segment display pins as outputs | ||
+ | for (int i = 0; i < 7; i++) { | ||
+ | pinMode(segmentPins[i], OUTPUT); | ||
+ | } | ||
+ | Serial.begin(9600); | ||
− | + | // Set the button pin as input | |
+ | pinMode(buttonPin, INPUT_PULLUP); | ||
+ | |||
+ | pinMode(12, OUTPUT); | ||
− | + | // Initialize the random seed | |
+ | randomSeed(analogRead(0)); | ||
+ | // Set the initial display to 0 | ||
+ | displayNumber(0); | ||
+ | } | ||
− | + | void loop() { | |
− | + | // Check if the button is pressed | |
− | + | if (digitalRead(buttonPin) == LOW && !buttonPressed) { | |
+ | buttonPressed = true; | ||
+ | Serial.print("megy"); | ||
− | int | + | for (int i = 0; i < 10; i++){ |
− | + | playSlotMachineSound(); | |
− | + | randomNumber = random(1, 7); | |
+ | // Display the generated number | ||
+ | displayNumber(randomNumber); | ||
+ | delay (20); | ||
+ | } | ||
+ | |||
+ | // Generate a random number between 1 and 6 | ||
+ | randomNumber = random(1, 7); | ||
+ | // Display the generated number | ||
+ | displayNumber(randomNumber); | ||
+ | } | ||
− | + | // Reset the button pressed flag if the button is released | |
− | + | if (digitalRead(buttonPin) == HIGH && buttonPressed) { | |
− | + | buttonPressed = false; | |
} | } | ||
+ | } | ||
+ | |||
+ | void playSlotMachineSound() { | ||
+ | // Define the frequencies for the sound | ||
+ | int frequencies[] = {262, 196, 440, 392, 349, 293}; | ||
− | + | // Play the sound for a short duration | |
+ | for (int i = 0; i < 6; i++) { | ||
+ | tone(12, frequencies[i], 100); | ||
+ | delay(20); | ||
+ | noTone(12); | ||
+ | //delay(50); | ||
+ | } | ||
} | } | ||
− | + | // Display a number on the 7-segment display | |
− | + | void displayNumber(int number) { | |
− | + | // Define the 7-segment display patterns for each digit | |
+ | const int digitPatterns[][7] = { | ||
+ | {1, 0, 0, 1, 1, 1, 1}, // 1 | ||
+ | {0, 0, 1, 0, 0, 1, 0}, // 2 | ||
+ | {0, 0, 0, 0, 1, 1, 0}, // 3 | ||
+ | {1, 0, 0, 1, 1, 0, 0}, // 4 | ||
+ | {0, 1, 0, 0, 1, 0, 0}, // 5 | ||
+ | {0, 1, 0, 0, 0, 0, 0}, // 6 | ||
+ | }; | ||
− | + | // Display the segments for the given number | |
+ | if (number >= 1 && number <= 6) { | ||
+ | // Display the segments for the given number | ||
+ | for (int i = 0; i < 7; i++) { | ||
+ | digitalWrite(segmentPins[i], digitPatterns[number - 1][i]); | ||
+ | } | ||
+ | } | ||
+ | } | ||
− | |||
</source></tab> | </source></tab> | ||
− | |||
− | |||
− | Zdrojový kód: [[Médiá: | + | Zdrojový kód: [[Médiá:Digital_dice_bg_hp.zip|Digital dice]] |
+ | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Kľúčové slová 'Category', ktoré sú na konci stránky nemeňte. | Kľúčové slová 'Category', ktoré sú na konci stránky nemeňte. | ||
[[Category:DTV]][[Category:DTV2023]] | [[Category:DTV]][[Category:DTV2023]] |
Aktuálna revízia z 11:57, 18. jún 2023
Záverečný projekt predmetu DTV / LS2023 - Péter Heller, Gabriel Bukriš
Obsah
Ako sa hrá človeče?
► Cieľom hry je dostať všetky štyri figúrky zo štartového poľa na cieľové polia.
► Po hodení šestky môže figúrka odštartovať.
► Pritom musia figúrky raz obísť všetky polia, bez toho, aby ju súper nevyhodil.
► Počet prejdených polí sa určí hodom očíslovanej kocky.
Používané technológie
Figúrky │ 3D tlač
Najprv sme museli navrhnúť herné figúrky. Na to sme použili OPENSCAD.
Potom sme chceli, aby každá herná figúrka bola jedinečná pre 4 hráčov, preto sme navrhli 4 rôzne typy klobúkov, ktoré sme umiestnili na základný model.
Potom sme išli do fablabu a vytlačili sme ich v rôznych farbách.
Herná plocha │ Laser
► Plocha je z dreva
► Hernú plochu sme vyrezali s laserom
► Hracie polia sú gravírované
Kocka │ Elektronika
Rozhodli sa vytvoriť digitálnu kocku so zvukovými efektmi.
Použité komponenty:
► Arduino UNO
► 6 segment display
► Gombík
► Buzzer
► Resistor 330Ω
// Constants for the 7-segment display pins
const int segmentPins[] = {2, 3, 4, 5, 6, 7, 8};
// Button pin
const int buttonPin = 9;
// Variables
int randomNumber = 0;
bool buttonPressed = false;
void setup() {
// Set the 7-segment display pins as outputs
for (int i = 0; i < 7; i++) {
pinMode(segmentPins[i], OUTPUT);
}
Serial.begin(9600);
// Set the button pin as input
pinMode(buttonPin, INPUT_PULLUP);
pinMode(12, OUTPUT);
// Initialize the random seed
randomSeed(analogRead(0));
// Set the initial display to 0
displayNumber(0);
}
void loop() {
// Check if the button is pressed
if (digitalRead(buttonPin) == LOW && !buttonPressed) {
buttonPressed = true;
Serial.print("megy");
for (int i = 0; i < 10; i++){
playSlotMachineSound();
randomNumber = random(1, 7);
// Display the generated number
displayNumber(randomNumber);
delay (20);
}
// Generate a random number between 1 and 6
randomNumber = random(1, 7);
// Display the generated number
displayNumber(randomNumber);
}
// Reset the button pressed flag if the button is released
if (digitalRead(buttonPin) == HIGH && buttonPressed) {
buttonPressed = false;
}
}
void playSlotMachineSound() {
// Define the frequencies for the sound
int frequencies[] = {262, 196, 440, 392, 349, 293};
// Play the sound for a short duration
for (int i = 0; i < 6; i++) {
tone(12, frequencies[i], 100);
delay(20);
noTone(12);
//delay(50);
}
}
// Display a number on the 7-segment display
void displayNumber(int number) {
// Define the 7-segment display patterns for each digit
const int digitPatterns[][7] = {
{1, 0, 0, 1, 1, 1, 1}, // 1
{0, 0, 1, 0, 0, 1, 0}, // 2
{0, 0, 0, 0, 1, 1, 0}, // 3
{1, 0, 0, 1, 1, 0, 0}, // 4
{0, 1, 0, 0, 1, 0, 0}, // 5
{0, 1, 0, 0, 0, 0, 0}, // 6
};
// Display the segments for the given number
if (number >= 1 && number <= 6) {
// Display the segments for the given number
for (int i = 0; i < 7; i++) {
digitalWrite(segmentPins[i], digitPatterns[number - 1][i]);
}
}
}
Zdrojový kód: Digital dice
Kľúčové slová 'Category', ktoré sú na konci stránky nemeňte.