Question

Can you show me a Flappy Bird game's code running in Visual Studio 2015 (The language...

Can you show me a Flappy Bird game's code running in Visual Studio 2015 (The language is C++), please?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//Flappy bird game's code written in c++ language.
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <time.h>
using namespace std;

int main()
{
srand(time(0));//to make the program randomize
char mv;
char repeat='y';
int highscore=0;
while (repeat=='y'){
int score=0;
bool wasit=true;
int x=9;
int rintangan[3]; // the y-asis of obstacle
int rintang[3]; // the x-asis of obstacle
rintang[0]=10;
rintang[1]=18;
rintang[2]=27; // the starting x-asis of obstacle
for (int i=0;i<3;i++)
{
rintangan[i]=(rand()-1)%12+2;
}
string map[20][30];
for (int i=0;i<20;i++)
{
for (int j=0;j<30;j++)
{
if ( i==0 || i==19|| j==29 || j==0)
map[i][j]="* ";
else
map[i][j]=" ";
}
}
while (wasit == true)
{
for (int i =0;i<3;i++)
{
for (int j=1;j<19;j++)
{
map[j][rintang[i]]=" ";
}
}
for (int i=0;i<3;i++) //make the obstacle move from right to left
{
rintang[i]--;
}
for (int i =0;i<3;i++) //make the obstacle back to right side if it touched left side
{
for (int j=1;j<19;j++)
{
map[j][rintang[i]]="* ";
}
}
for (int i=0;i<3;i++) //to make a hole at the obstacle
{
map[rintangan[i]][rintang[i]]=" ";
map[rintangan[i]+1][rintang[i]]=" ";
map[rintangan[i]+2][rintang[i]]=" ";
map[rintangan[i]+3][rintang[i]]=" ";
map[rintangan[i]+4][rintang[i]]=" ";
}
for (int i=0;i<3;i++)
{
if (rintang[i]==1)
{rintang[i]=28;
rintangan[i]=(rand()-1)%12+2;
}
}
map[x][3]=" ";
if (kbhit())
{
mv=getch();
x=x-3;
}
x++;
if(x<1)
x=1;
for (int i=0;i<3;i++)
{
if (rintang[i]==3)
if (map[x][3]==" ")
score=score+1;
if (map[x][3]=="* ")
wasit=false;
}
map[x][3]="& ";
for (int i=1;i<19;i++)
{
map[i][1]=" ";
}
for (int i=0;i<20;i++)
{
for (int j=0;j<30;j++)
{
cout << map[i][j];
}
cout <<endl;
}
cout << "Score = "<<score;
Sleep (100);
system ("cls");
}
cout << "Score = " <<score<<endl;
if (highscore<score)
highscore=score;
cout << "Highscore= "<<highscore<<endl;
cout << "retry?(y/n) = "; cin >>repeat;}
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Can you show me a Flappy Bird game's code running in Visual Studio 2015 (The language...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using assembly language in microwoft visual studio write the following code with procedure with c...

    using assembly language in microwoft visual studio write the following code with procedure with correct number of Fib numbers Your program should detect the largest Fib number that can be calculated. Besides storing the result in an array, print them on the screen.

  • The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language....

    The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language. The book ISBN number that I am using is: 978-1-285-08416-9 or the UPC code is: 2-901285084168-1. Question 1 Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program�s goal. Question 2 An application that has a Web user interface and runs on a server is called a(n) ____________________ application. Question 3...

  • Now that you have used Visual Studio and learned about the Visual Basic programming language, how...

    Now that you have used Visual Studio and learned about the Visual Basic programming language, how do you feel about programming? Do you think that you will learn other programming languages in your chosen field? In response to your peers, explore each other's reactions to learning Visual Basic and Visual Studio. Find someone looking to pursue a similar field and discuss what other possible languages you may learn.

  • please help me finish this, it is for Visual Basic . net in Visual studio 2010...

    please help me finish this, it is for Visual Basic . net in Visual studio 2010 (show pictures of code and of the form please) Lab #5 - Banking Account with Methods Submit Assignment Download Work file Download Runtime Be sure to include comments at the top of each procedure and at the top of the file. Be sure to use meaningful names for all buttons and labels. In this lab you will create a simple banking application that will...

  • Visual Basic (VB) Code on Visual Studio Code a Visual Basic (VB) program that calculates the...

    Visual Basic (VB) Code on Visual Studio Code a Visual Basic (VB) program that calculates the final grade a school course. The program will ask the user to enter ten grades for assignments (each is out of 25), five grades for quizzes (each out of 30), a midterm grade out of 300, extra-credit final project points (out of 100), final test points (out of 300) The program will add all of the points you entered and show you a letter...

  • VISUAL BASIC (VISUAL STUDIO 2010) - PLEASE INCLUDE PICTURES OF OUTPUT AND CODE AND TEXTBOX pictures...

    VISUAL BASIC (VISUAL STUDIO 2010) - PLEASE INCLUDE PICTURES OF OUTPUT AND CODE AND TEXTBOX pictures of everything or thumbs downnnnnnn... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: VISUAL BASIC (VISUAL STUDIO 2010) - PLEASE INCLUDE PICTURES OF OUTPUT AND CODE AND TEXTBOX Be sur... VISUAL BASIC (VISUAL STUDIO 2010) - PLEASE INCLUDE PICTURES OF OUTPUT AND CODE AND TEXTBOX Be sure to include comments at the top of...

  • This requires the Use of Microsoft Visual Studio and Using the C language and I need...

    This requires the Use of Microsoft Visual Studio and Using the C language and I need any help I can for the following project:

  • USING VISUAL BASIC STUDIO PLEASE PROVIDE THE CODE IN C# LANGUAGE SELECT CONSOLE APPLICATION You are...

    USING VISUAL BASIC STUDIO PLEASE PROVIDE THE CODE IN C# LANGUAGE SELECT CONSOLE APPLICATION You are to create a House with 2 rooms in the house. The following is an example of C++ code for the basic classes: **in C#, it may be written differently** class Room { private: double L; double W; public: //functions go here. } class House { private: Room room1; Room room2; public: //functions go here } The code above is C++ version. In C#, you...

  • Must compile on Visual studio 2015 Programming language- C Goals (Requirements): You will simulate a trading...

    Must compile on Visual studio 2015 Programming language- C Goals (Requirements): You will simulate a trading application. There will be two components: A simulation for the stock market, and a facility that will allow you to trade five stocks several times. It will also maintain the portfolio and balances of your stock and money Background We buy and sell stocks' from the "Stock Market". You can check the price of the stock before you place an order to buy or...

  • can somebody help me with this please. This is for Visual Basic Write the code for...

    can somebody help me with this please. This is for Visual Basic Write the code for an application that calculates the sum of two integer variables (intVar1, intVar2) and store it in a third integer variable (intSum). You should have two text boxes (txtVar1, txtVar2) and a label (lblSum) to show your result.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT