Midterm Project – Duck Hunt

Duck Hunt sketch: 

For this assignment, I researched retro arcade games and decided I want to make a replica of the classic NES game Duck Hunt. Initially, I started with the background on which I built the rest of the game. Then, I used a sprite sheet that changes the ducks to dead ducks when shot. That was done using the following code, which is also the code that decides the gravity of the falling duck:

if (shot == true) {
  speed = -7;
  speed2 = 0
  push();
  noStroke();
  fill(220);
  duck(deadDuck);
  pop();
  
  if (y > 440) {
    shot = false;
    x = random(5, 580);
    speed = random(4,12);
    speed2 = random(-7,7);
    score += 1;
  }
}

I had several versions of the game until I decided to go with the final one in which you have unlimited ammo but a limited time to shoot as many ducks as possible. This way, the game can be played by anyone, however the score gives it a competitive edge in a sense that players can compete with their own previous score.

Regarding the code and the technical aspect of my assignment, I would say I am most proud of setting the timer to countdown from whatever value we assign to it. This was done with the following code:

fill(0, 0, 0);
  textSize(30);
  text("Time Left:" + timer, 25, 380)
  if (frameCount % 60 == 0 && timer > 0) {
    timer --;
  }
  if (timer == 0) {
    //text("GAME OVER", 200, 200);
    window.location.reload();

The timer additionally ends the game and displays the home screen. This particular switch from the home screen to the game was a problem that I was luckily able to overcome. Additionally, I ran into a problem while using OOP in one of the earlier versions. As I could not fix this problem I decided just to switch up and not use OOP. This is one of the few key changes that should be done to improve the game in the future. Other than this, I should improve the spawning points of the ducks as well as implement another paradigm to run the game including limited ammo, power ups and difficulty levels.

Finally, this game has a lot of space to improve, but it is a good starting point. I personally chose this game in order to recreate the feelings and experience of hunting for ducks on the NES using the gun controllers. I plan on doing this with the help of Arduino.

 

Leave a Reply