We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

CS602 - Computer Graphics Assignment No. 04 last date for assignment submission is Tuesday, August 11, 2015.


Assignment No. 04
Semester: Spring 2015

CS602: Computer Graphics

 

Total Marks: 20

 

Due Date:11/08/2015

Instructions

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Solution is copied from any other source.

Objective

The objective of this assignment is to;

  • Learn to develop a small and simple Arkanoid Game.

 

Assignment

This assignment is based on our previous assignments. Please see the given startup code for this assignment (in attached folder Startup_Code) which is same as solution of Assignment No.3 with slight modification. Open Assigment4.dev project file in Dev-C++ and after successful compilation and execution, you will see the output. You can see the code in order to understand how coordinates of the Ball and Bar are modified to introduce motion effect. You can see that the Bar’s movement is controlled via keyboard Left and Right arrow keys.

After understanding it’s working, you need to further modify the code as desired in this assignment.

 

Your Task

Your task is to slightly modify the provided code to get desired output as shown in the executable “Desired_Output.exe”. This is more like Arkanoid Game. In start-up code, the Bar is moving but its inactive and you have to make it functional i.e. the Ball shall change its direction after hitting the Bar. Player will lose the game if Ball hits the ground and Game will restart by displaying proper message. Play score shall be displayed in the corner and it gets updated each time the Ball hits the Bar.

 

Hint: You just need to add few lines of code to control movement of Ball by seeing if it hits or miss the Bar.

Submission

You are required to submit your solution through LMS in zip format containing two files.

  • Your Project in zipped form containing both .dev and .cpp file.

An MS Word document containing screenshot of your program output/execution and your own Student-ID must be visible in the screenshot.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2809

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

KOI MUJY GRAPHIC AUR LIB KI FILE DY DE ME NE DEV NEW INSTAL KIYA HE PLZ

sis ye files ap ko chae.............

Attachments:

ahan this game.... we r going now to make it ready ... 

any idea from how to control the motion of the ball?

plz anyone share the code ....

Sir har bari ise type ki he assignment q daty ha

PLEAS UPLOD THE CODE PLEAS

my assignment run like vu output but requirements mein likha hua ha on fail py msg b dy or game restart b ho. wo msg reh gea :( kesy ho ga kia wo java k through aa rha ha msg?

plz hint dain kese collison detect ki

will you help us please ? how to detect the collision with the bar? 

ye file kdr kdr paste kerni he plz screen shot dy


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>
#include <time.h>
#include <windows.h> // WinApi header

void drawBall(int x, int y, int col)
{
setcolor(col);
setfillstyle(1,col);
circle(x,y,20);
floodfill(x,y,col);
}
void drawBar(int x, int y)
{
setlinestyle(SOLID_LINE,0, THICK_WIDTH);
line(x,y,x+150,y);
line(x,y+4,x+150,y+4);
}
void outScore(int x, int y, int value)
{
char digit_string[20];
sprintf(digit_string, "%d", value);
outtextxy(x, y, "Score:");
outtextxy(x+100, y, digit_string);
}


int main()
{
int gd,gm;

detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");


int count=0;

start:
int x =20;
int y =80;
int color = 0;

int bar_x,bar_y;
bar_x=getmaxx()/3;
bar_y=getmaxy()-50;

bool flag_y=true , flag_x = true;

int new_page, old_page; // declare integer variables representing two graphics pages
srand(time(NULL));
x = rand ()% getmaxx();
while(1)
{

old_page = getvisualpage( ); // set old_page to the number of the visual page
new_page = abs(old_page-1); // set new_page to the visual page number-1
setactivepage(new_page); // set the active page to the value of the new page
cleardevice( ); // erase the active page
setbkcolor(WHITE);
setcolor(RED);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
outtextxy(10, 10, "Welcome to Graphics Programming");
outtextxy(10, 30, "My VU-ID is BC123456789");
line(0,60,getmaxx(),60);
delay(20);

//on mouse click ball change its color
// will be implemented.
if(kbhit()){
int ch=getch();
if (ch==75 && bar_x>5)
bar_x-=10;
if (ch==77 && bar_x < getmaxx()-150)
bar_x+=10;
}

drawBall(x,y, color);
drawBar(bar_x,bar_y);
outScore(450,30,count);
setvisualpage(new_page); // move the activepage to the visual page

//updaing y cordinates.
if (y <= getmaxy()-20 && flag_y)
{
y +=3;
}
else{
y-=3;
flag_y = false;
}
if (y<= 20+60 && !flag_y)
{
flag_y = true;
//Beep(523,50);
}

//updateing x cordinates

if (x <= getmaxx()-20 && flag_x)
{
x +=3;
}
else{
x-=3;
flag_x = false;
}
if (x<= 20 && !flag_x)
{
flag_x = true;
//Beep(523,50);
}

}

getch();
closegraph();
}

plz check it

RSS

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.