0% found this document useful (0 votes)
3 views

Game_Assignment

The document outlines an assignment to develop a modern version of the Chicken Invaders game, originally released in 1999. It details the steps to implement game features such as player movement, shooting mechanics, health and scoring systems, and the use of images for graphics. Additionally, it includes a bonus step for adding sound effects to enhance gameplay.

Uploaded by

rashedmohamed487
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Game_Assignment

The document outlines an assignment to develop a modern version of the Chicken Invaders game, originally released in 1999. It details the steps to implement game features such as player movement, shooting mechanics, health and scoring systems, and the use of images for graphics. Additionally, it includes a bonus step for adding sound effects to enhance gameplay.

Uploaded by

rashedmohamed487
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Page 1 of 2

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!

What are we building

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.

STEP#1 : Adding the spaceship and the chickens

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));

STEP#2 : Let’s shoot laser:

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

STEP#3: Health and score

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.

TIPS: 1. How to display a text message in QT:

setPlainText(QString(“The message “you want to display”) +


QString::number(The_name_of_the_variable));
2. You either create a class for the heart and score or you create in the player class
3. Use QMessageBox to display the message.
msg = new QMessageBox; //This is how you create a message box.
your can then use the function: setText(), setWindowTitle() to set the text of the
message box with the score and the tile of the window however you want.

BONUS STEP:

You are required to add sound when the bullet is emitted and when the chicken is destroyed.

You might also like