Moving object in C/C++ graphics Emulator in Dev C++ | By Source Code
Hello friend today in this video i will show you how to move a bar in c/c++ graphics and you can move any object in c/c++ graphics use this method and made a game i'm made this program in Dev c++ and use emulator.
click here to see this video on youtube
/* Source Code */
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
int i=10,j=200,k=300;
void control();
int main()
{
int j,gd=DETECT,gm;
initgraph(&gd,&gm,"");
while(1)
{
control();
}
getch();
closegraph();
}
void control()
{
bar(j,470,k,500);
if(GetAsyncKeyState(VK_LEFT))
{
j-=i;
k-=i;
}
else if(GetAsyncKeyState(VK_RIGHT))
{
j+=i;
k+=i;
}
bar(j,470,k,500);
delay(10);
cleardevice();
}
Comments
Post a Comment