For me, the hardest part (other than the coding *starts crying*) is not to change my idea. My initial idea was to recreate WHACK-A-MOLE game, but since I’m recreating it to be my own I’m going to make it WHACK-A-VAMP (whacking vampires instead of moles hahaha so creative). And so, to insure that I won’t change my idea, I started drawing the background *I’m drawing the characters and the setup of the game on my own*
And then I want to make a self-portrait vampire and the inspiration is myself and this lil vmap (yes my idea for the first assignment was to make a self-portrait vampire and I don’t know why)
But drawing a face takes too long for me so I will do it on the weekend since I like to draw in one sitting and this will probably take around 7-8 hours straight.
As of the code, this is what I’ve got going so far:
// variable declaration
const int rLED = 2;
const int bLED = 3;
const int gLED = 4;
const int yLED = 5;
const int rButton = 9;
const int bButton = 8;
const int gButton = 7;
const int yButton = 6;
void setup()
{
//Set LED pins, displays light
pinMode(rLED, OUTPUT);
pinMode(bLED, OUTPUT);
pinMode(gLED, OUTPUT);
pinMode(yLED, OUTPUT);
//Set Buttons as inputs. controls if the user whacked the vamp
pinMode(rButton, INPUT);
pinMode(bButton, INPUT);
pinMode(gButton, INPUT);
pinMode(yButton, INPUT);
}
void loop()
{
// here is the code for when the LED lights are represented as the vamps so that once i'm done with the processing animation part i would just add another condition which is for the vamp to be shown on screen
for(int i = 0; i < 10; i++)
{
//Randomly turns on an LED
digitalWrite(random(2, 6), HIGH);
//Checks if any of the LEDs are on
while(digitalRead(rLED) == HIGH || digitalRead(bLED) == HIGH || digitalRead(gLED) == HIGH ||digitalRead(yLED) == HIGH)
{
//Functions that turns off the randomly lit LED
if (digitalRead(rLED) == HIGH)
{
// Makes sure button is pressed
if (digitalRead(rButton) == HIGH)
{
//Turns off LED
digitalWrite(rLED, LOW);
}
}
if (digitalRead(bLED) == HIGH)
{
// Makes sure button is pressed
if(digitalRead(bButton) == HIGH)
{
//Turns off LED
digitalWrite(bLED, LOW);
}
}
if (digitalRead(gLED) == HIGH)
{
//Makes sure button is pressed
if(digitalRead(gButton) == HIGH)
{
//Turns off LED
digitalWrite(gLED, LOW);
}
}
if (digitalRead(yLED) == HIGH)
{
// Makes sure button is pressed
if(digitalRead(yButton) == HIGH)
{
//Turns off LED
digitalWrite(yLED, LOW);
}
}
delay(100);
}
}
// ends the game
for (int i = 0; i < 3; i++)
{
digitalWrite(rLED, HIGH);
digitalWrite(bLED, HIGH);
digitalWrite(gLED, HIGH);
digitalWrite(yLED, HIGH);
delay(250);
digitalWrite(rLED, LOW);
digitalWrite(bLED, LOW);
digitalWrite(gLED, LOW);
digitalWrite(yLED, LOW);
delay(250);
}
}
This was emailed to professor on the 19th of April

