Impossible Duck Hunt

Impossible Duck Hunt

import ddf.minim.*;

import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

Minim minim;
AudioPlayer player;

int step = 0;
int numFrames = 10;
int numFrame = 3;
int numFrame1 = 3;
int numFrame2 = 2;
int frame = 0;
int frames = 0;
int frame1 = 0;
int frame2 = 0;
PImage[] images = new PImage[numFrames];
PImage[] image = new PImage[numFrame];
PImage[] image1 = new PImage[numFrame1];
PImage[] image2 = new PImage[numFrame2];
long timer;
float framespeed = 400;
boolean move;
int moveX = 1;
int X = 1;
int x = 445;
int moveY = 400;
int Y = 200;
int y = 320;
int stage;
int incX = 200;
int incY = 120;

void setup (){
size (890, 558);
images[0] = loadImage(“Dog.png”);
images[1] = loadImage(“Dog2.png”);
images[2] = loadImage(“Dog3.png”);
images[3] = loadImage(“Dog4.png”);
images[4] = loadImage(“Dog5.png”);
images[5] = loadImage(“Dog4.png”);
images[6] = loadImage(“Dog5.png”);
images[7] = loadImage(“Dog6.png”);
images[8] = loadImage(“Dog7.png”);
images[9] = loadImage(“Dog8.png”);

image[0] = loadImage(“duck.png”);
image[1] = loadImage(“duck1.png”);
image[2] = loadImage(“duck2.png”);

image1[0] = loadImage(“duck6.png”);
image1[1] = loadImage(“duck7.png”);
image1[2] = loadImage(“duck8.png”);

image2[0] = loadImage(“Dog9.png”);
image2[1] = loadImage(“Dog10.png”);

minim = new Minim(this);
player = minim.loadFile(“Doglaugh.mp3”);
player.loop();

timer = millis();
imageMode(CENTER);
noCursor();
}

void draw (){
PImage background;
background = loadImage(“background.png”);
image(background, 445, 279);
PImage grass;
grass = loadImage(“DHGrass.png”);
image(grass, 445, 142);

if (millis() – timer > framespeed){
timer = millis();
frame++;
frames++;
frame1++;
frame2++;
}
if (frame == numFrames) {
frame = 0;
} if (frames == numFrame){
frames = 0;
} if (frame1 == numFrame1){
frame1 = 0;
} if (frame2 == numFrame2){
frame2 = 0;
}

if (step == 0) {
image(images[frame], moveX, moveY);
moveX = moveX + 5;
if (moveX >= 200){
moveX = 200;
if (frame >=5){
frame = 0;
step = 1;
}}}
else if (step == 1) {
image(images[frame], moveX, moveY);
moveX = moveX + 5;
if (moveX >= 400){
moveX = 400;
if (frame >=6){
frame = 6;
step = 2;
}}}
else if (step == 2){
PImage Dogg;
Dogg = loadImage(“Dog6.png”);
image(Dogg, moveX, moveY);
moveX = moveX+1;
if (moveX >= 405){
moveX = 405;
step = 3;
}}
else if (step == 3) {
PImage Dogjump;
Dogjump = loadImage(“Dog7.png”);
image(Dogjump, 400, moveY);
moveY = moveY – 8;
if (moveY <= 280){
moveY = 280;
if (frame >= 9){
frame = 9;
step = 4;
}}}
if (step == 4) {
PImage Doggone;
Doggone = loadImage(“Dog8.png”);
image(Doggone, moveX, moveY);
moveY = moveY + 1;
moveX = moveX + 1;
if (moveY >= 290){
moveY = 290;
if (moveX>= 415){
moveX = 415;
step = 5;
}}}
else if (step == 5) {
textAlign(CENTER);
fill (255);
textSize(50);
text(“Stage ” + (stage+1), width/2, height/4);
text(“Click to Continue”, width/2, height/4+50);
}
if (step == 6) {
image(image[frames], X, Y);
X = X + 10;
if (X >= 1000){
X = 0;
}}
if (step == 7) {
image(image1[frames], X, Y);
Y = Y – 5;
if (Y <= – 50){
Y = -50;
step = 8;
}}

fill (0,0,0,0);
ellipse (mouseX, mouseY, 20, 20);
line(mouseX, mouseY-10, mouseX, mouseY+10);
line(mouseX-10, mouseY, mouseX+10, mouseY);

if (step == 8) {
image(image2[frame2], x, y, incX, incY);
incX = incX + 10;
incY = incY + 5;
if (incX >= 1800){
incX = 1800;
if (incY >= 800){
incY = 800;
}}}
}
void mousePressed() {
step = step + 1;
}

Advertisements
This entry was posted in Time-Based and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s