Game_Assignment
Game_Assignment
CSCE1102 Assignment
02 – Chicken Invaders
Description
The original Chicken Invaders game was published on July 24, 1999, and it
is the rst in the franchise. The player controls a single spacecra by sliding
it horizontally across the bo om of the screen and ring at swarms of
invading extraterrestrial chickens in this xed shooter game.
Take the fate of the world into your own hands (or at least enjoy an
omelet) in this modern version of the '90s classic.
Save the world today!
In the last section, we started creating a simple shooting game but with no graphics or sound effects so
what’s the fun in that?!?.
In this assignment we will convert it to the chicken invaders game.
The output from last section should be a rectangle displayed on the screen and responsive to up,
down, left and right keys on the keyboard. In addition, when the space key pressed a bullet will be
emitted from the rectangular shape.Also a continuous spawning of chicken from the top of the
screen from random positions. Whenever the bullet touches the enemy, the enemy is destroyed.
Rather than a rectangle, add the image “ship.png” so that the player can move this ship
around. These enemies will be represented by the image “chicken.png”.
TIPS: the player class must inherit from the QGraphicsPixmapItem class and the change will
happen in the constructor of the player class.
The change will occur in the constructor, rather than using the function setRect(), use
setPixmap(QPixmap(“The_path_of_the_image”));
If the image is too big you can scale is:
setPixmap(QPixmap(“The_path_of_the_image”).scaled(height, width));
The laser will be represented by the image “red_laser.png” that will be emitted from the
spaceship whenever the space bar is pressed. Since the bullet will be represented by an image
as well, it will inherit from QGraphicsPixmapItem.
fi
tt
fi
fi
ft
Page 2 of 2
You should have a function that will decrease the health value that is initially set to 3, whenever
the enemy will bypass the spacecraft. Create a function called “decrease()”, that will decrease
the score by one and display it on the screen with a red colour. In the same function, you need
to check the health value if it is less than 1, the player lose and display a game over message
and the score that the player reached.
The same goes for the score, there will be a function that will increase its value whenever the
bullet hits the enemy. Create a function called “increase ()” That will increase the score by one
and the display it on the screen by a blue colour.
BONUS STEP:
You are required to add sound when the bullet is emitted and when the chicken is destroyed.