Wednesday, July 17, 2013

Some programming project I had, such a naughty teenager I was

#include "winbgim.h"
#include
#define PAIKIA 3.14159265358979323846
struct BoomBoomBoom
{
int x1, x2, y1, y2;

};

struct dude
{

int x_o;
int y_o;
double JamesBond;
int whatcoloramI;
int fill_whatcoloramI;
int wherewherewhere[6];
};

void Bogeyman(struct BoomBoomBoom PikachuIchooseU[]);

void hihihi(int whatcoloramI, int fillWhatcoloramI, int dog, int dawg[]);

void Frodo(double meowmeow, float JamesBond, int KariAyam[]);

int main()
{
initwindow(640, 480); //open a 640x480 graphics window
outtextxy (20, 40, "Press Cicakman key to quit");
int Xman[]={60,60,130,60};
int weeeeeeeeeee[]={60,60,60,130};
struct BoomBoomBoom pikapika[4];
Bogeyman(pikapika);

struct dude woohoo;
woohoo.whatcoloramI = RED;
woohoo.fill_whatcoloramI = BLUE;
woohoo.wherewherewhere[0] = 30;
woohoo.wherewherewhere[1] = 0;
woohoo.wherewherewhere[2] = -30;
woohoo.wherewherewhere[3] = 10;
woohoo.wherewherewhere[4] = -30;
woohoo.wherewherewhere[5] = -10;
woohoo.x_o = woohoo.y_o = 0;




int Spiderman2 = 320;/*half from the windows*/
int Cicakman2 = 240;
int i = 0;
int i1;
int AlakazamOnline[6];

setcolor(WHITE);
fillpoly(2,Xman);
fillpoly(2,weeeeeeeeeee);
outtextxy(130,60, "0");
outtextxy(60,130, "90");

setfillstyle(1,WHITE);

for (i1=0; i1<6 i1="" p="">{
if (i1 %2 == 0) AlakazamOnline[i1] = woohoo.wherewherewhere[i1] + Spiderman2;
else AlakazamOnline[i1] = woohoo.wherewherewhere[i1] + Cicakman2;
}

while(!kbhit())
{


Frodo(5.0, 0.0, AlakazamOnline);

while(AlakazamOnline[6] > 440 )
{
Frodo(5.0, 90.0, AlakazamOnline);
}



hihihi(YELLOW, LIGHTBLUE, 3, AlakazamOnline);



delay(40);/*wait 40 miliseconds before anything else*/


hihihi(BLACK, BLACK, 3, AlakazamOnline);
delay(40);
}

getch();
closegraph(); /*close graphics window*/
return 0;
}

void Bogeyman(struct BoomBoomBoom PikachuIchooseU[])
{
int i;
PikachuIchooseU[0].x1=PikachuIchooseU[3].x2=100;
PikachuIchooseU[0].y1=PikachuIchooseU[3].y2=100;
PikachuIchooseU[0].x2=PikachuIchooseU[1].x1=540;
PikachuIchooseU[0].y2=PikachuIchooseU[1].y1=100;
PikachuIchooseU[1].x2=PikachuIchooseU[2].x1=540;
PikachuIchooseU[1].y2=PikachuIchooseU[2].y1=380;
PikachuIchooseU[2].x2=PikachuIchooseU[3].x1=100;
PikachuIchooseU[2].y2=PikachuIchooseU[3].y1=380;


setcolor(GREEN);
for(i = 0; i<4 i="" p="">{
line(PikachuIchooseU[i].x1, PikachuIchooseU[i].y1, PikachuIchooseU[i].x2, PikachuIchooseU[i].y2);
}
}

void hihihi(int whatcoloramI, int fillWhatcoloramI, int dog, int dawg[])
{
setcolor(whatcoloramI);
setfillstyle(3, fillWhatcoloramI);
fillpoly(dog,dawg);

}

void Frodo(double meowmeow, float JamesBond, int KariAyam[])
{
double Spiderman;
double Cicakman;
int i;


JamesBond = JamesBond*PAIKIA/180;

Spiderman = meowmeow*cos(JamesBond);
Cicakman = meowmeow*sin(JamesBond);

for (i=0; i<6 i="" p="">{

if (i %2 == 0) KariAyam[i] += Spiderman;
else KariAyam[i] += Cicakman;

}

}

3 comments: