i'm trying to make a geme with c++ but i can finish it because i have trouble with the code :( .....this is the code of the game that i want to make....
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
//using namespace std;
int main(void)
{
double pos_x,i_pos_x,pos_y,i_pos_y,vel_x,vel_y;
double time,gravity ; //t=time,g=gravity
int x_position,y_position;
initwindow(640,480);
//stick person
setcolor(CYAN);
circle(50,200,30);
setfillstyle(1,3);
floodfill(50,200,3);
setcolor(CYAN);
line(50,230,50,300);//badan
line(20,250,80,250);//tangan
line(50,300,90,340);//kaki kanan
line(50,300,10,340);//kaki kiri
//stand
setcolor(3);
line(0,340,110,340);//2
line(110,340,110,450);//3
line(0,450,110,450);//4
line(0,340,0,450);//1
setfillstyle(1,3);
floodfill(100,440,3);
line(0,450,640,450);//platform
//box
line(400,380,400,450);//1
line(400,450,500,450);//2
line(500,380,500,450);//3
//ball
setcolor(RED);
circle(90,250,10);
setfillstyle(1,4);
floodfill(90,250,4);
pos_x=90;
i_pos_x=90;
pos_y=250;
i_pos_y=250;
vel_x=60;
vel_y=60;
gravity=9.81;
time=6.2;
moveto((int)pos_x,(int)pos_y);
for(pos_x=i_pos_x;pos_x<450;pos_x++)
{
time=(pos_x-i_pos_x)/vel_x;
pos_y=i_pos_y-(vel_y*time)+(9.81*time*time);
lineto((int)pos_x,(int)pos_y);
delay(7);
}
getch ();
closegraph();
return 0;
}
i'm trying to make the ball move but there is only the line that move not the ball at the stick person hand:-/ ...can somebody help me to solve this problem...:?: