Sky game

12
SKY GAME C++ LAB PROJECT SUPERVISOR: MAM MUNIBA ASHFAQ NAME: ILYAS HUSSAIN CLASS NO: 38 REG. NO: 13PWCSE 1041 SECTION B UNIVERSITY OF ENGINEERING AND TECHNOLOGY PESHAWAR

Transcript of Sky game

SKY GAMEC++ LAB PROJECT

SUPERVISOR: MAM MUNIBA ASHFAQ

NAME: ILYAS HUSSAIN

CLASS NO: 38

REG. NO: 13PWCSE 1041

SECTION B

UNIVERSITY OF ENGINEERING AND TECHNOLOGY

PESHAWAR

INTRODUCTION

This Is A 2d Flying Game

In This Game the Player has to control the Plane

He has to go from one Place To another within the time limit

If He Reached He Win The Game Other Wise He Loss The Game

2

A VIEW OF THE START SCREEN3

A VIEW OF THE GAME 4

CODDING

Codded In SFML (Simple And Fast Multimedia

Library)

SFML is A Video Library Used to Create 2D And

3D Games in C++

Used only the function of SFML Graphics, and

Audio Header Files

And some Standard Function of C++

5

CODDING

First Of all Create A Window Dimension of

Which Is Represented By A vector

ScreenDimension(620,500)

The Speed Of Plane is Controlled by

setFramerateLIimit Function Of SFML Graphics

Library

Then Load All The Necessary File From Disk

Such as Pictures, Plane and Music

sf::Clock Is Used to Control The Duration Of

6

FIRST GAME LOOP

Used sf::View To Show A Portion Of The

Screen

The First Game Loop Is For Start Menu

The Execution Control Remain here For 3

Sec

After 3 sec the control goes on to the

Second Lop automatically and the game

start

7

SECOND GAME LOOP

The Complete Game is Proceed In This Loop

Here We Used sf::Event to Check that if there is

some pending event like close

Then we Used sf::Keyboard with if() to Check

Input From Keyboard for Controlling the

Coordinate of The Planes

Then We Used the setPosition() Function to Set

The position Of the Plane and all the File Loaded

From the Disk in the Start of the Game

8

SECOND LOOP (CONTINUE)

And Also used sf::view to Shoe that

portion of the Screen Where the Plane Is

Moving

The Execution Control remain in this

loop for 35 Second or Until the Y

Coordinate of the Plane Become less then

-1150

When the loop condition become

9

LAST LOOP OF THE GAME

In the last loop we Check For two condition

If the time is greater then 35 sec it gives the

message you loss the Game

If the Y Coordinate of the Plane is less then

-1150 it Shows the Message you Win The

Game

And That’s The End OF The Game

10

11

12