HI!

#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
using namespace std;

int Aiming() {
if (rand() % 67 < 10)
return 11;
else
return rand() % 10 + 1;
}
int main() {
srand(time(NULL));
char enter;

int Hunter = true;
int HunterSkill = 9;
int HuntedDuck = 1;
string HunterName = "";
int DuckCount = 0;
int DuckKilled = 0;

cout << "Welcome to Bird Hunting Season!." << endl << "Do you already have a license to hunt for this season? \nPress [ ENTER ] if you do!.";
cin.get();

cout << "Please enter your name: ";
cin >> HunterName;

cout << "How Many Ducks you wanna Hunt? ";
cin >> DuckCount;

cout << "Get ready to Hunt!" << HunterName << "!" << endl;

while (Hunter && DuckKilled < DuckCount) {

int Duck = Aiming();

if (Duck > 10) {
cout << endl << "Here comes a pack of DUCKS!" << endl;
}
else {
cout << endl << "You better AIM that Duck! " << DuckKilled + 1 << endl;
}
cout << "Aiming... \nBe Careful! Not only ducks are flying around!" << endl;
sleep(2);

if (HunterSkill < Duck) {
Hunter = false;
cout << "Oh! SHOOT! You've' missed the target and nearly shot the other bird! it might be an ENDANGERED ONE!'." << endl;
}
else {
if (HunterSkill - Duck > 7) {
cout << "Impressive!" << endl;
HuntedDuck = HuntedDuck * 2;
}
else if (HunterSkill - Duck > 5) {
cout << "Nice SHOT!" << endl;
HuntedDuck = HuntedDuck * 2;
}

else if (HunterSkill - Duck > 0) {
cout << "That was a good AIM!" << endl;
HuntedDuck = HuntedDuck * 2;
}
else {
cout << "You killed a DUCK but you need to focus on our target, You might hurt or killed other Bird!." << endl;
}

DuckKilled++;
}
cout << endl;
sleep(1);
}
if (DuckKilled == DuckCount) {

cout << "Congratulation!" << endl;
}
else {
cout << "Sorry, But we need to Stop. Your Aiming is not that Good you might HURT other Animal!. \nComeback Again Next Time and Practice Your AIMING SKILL!" << endl;
}
cout << "Duck killed: " << DuckKilled << endl;
cout << "Final score: " << HuntedDuck << endl << endl;
}

(came from the zombie war i just edited it into duck hunting season. ) This is my code how can i put simple graphic on it
moving graphic like when you killed a duck its shows how you killed it
and when you missed it will show a hunter misses its target
Last edited on
You have two basic options:

1) Text graphics
>(.)__
 (___/

Google around “ascii duck”.

2) SDL2 or SFML
This is a bit more difficult, because you will no longer be using cin and cout to do stuff, but a primitive graphics library to interface with the user. Everything is through pictures.

It isn’t that hard to get started, but it is fairly involved, particularly for a beginner. Lazy Foo’s tutorial is a good place to start.
https://lazyfoo.net/tutorials/SDL/index.php

(I know there is another really good place also, but I don’t recall where.)

Good luck!
I need to draw the background in c++
hmmm.. graphics or moving graphics maybe
Topic archived. No new replies allowed.