This commit is contained in:
flo 2017-04-22 21:02:24 +02:00
parent 4ce3a3b999
commit c67fa42df4
11 changed files with 64 additions and 20 deletions

BIN
obj/cloud.bmp.o Normal file

Binary file not shown.

BIN
obj/img_menu.bmp.o Normal file

Binary file not shown.

BIN
obj/maths.c.o Normal file

Binary file not shown.

BIN
obj/missiles.bmp.o Normal file

Binary file not shown.

BIN
obj/plane.bmp.o Normal file

Binary file not shown.

BIN
obj/wings.c.o Normal file

Binary file not shown.

View File

@ -6,7 +6,12 @@ float fcos(unsigned char x)
{
float cos[4] = {1.0, 0.707106, 0.0, -0.707106};
return (x < 4 ? cos[x] : - cos[x%4]);
while(x >= 4)
{
x-=4;
}
return cos[x];
}
float fsin(unsigned char x)

View File

@ -12,7 +12,7 @@
#define SIZE_MAP_X 256
#define SIZE_MAP_Y 256
#define MAX_PLANES 3
#define MAX_PLANES 2
Plane planes[MAX_PLANES]; // number of planes in the map (with us)
//others planes are controlled by the AI
@ -59,6 +59,24 @@ void AI() // iA start
}
}
void infos()
{
unsigned int key = 0;
while(key != KEY_SHIFT)
{
dclear();
dtext(1, 1, "All informations");
dprint(1, 10, "life : %d", planes[0].life);
dprint(1, 20, "shoot : %d", planes[0].reload);
dtext(1,54,"F1 to leave");
dupdate();
key = getkey();
}
}
int menu()
{
unsigned char menu = 0;
@ -99,27 +117,29 @@ void *update_frame()
dclear();
switch(planes[0].dir)
{
case 0 : decalx--; break;
case 1 : decalx--; decaly++; break;
case 2 : decaly++; break;
case 3 : decalx++; decaly++; break;
case 4 : decalx++; break;
case 5 : decalx++; decaly--; break;
case 6 : decaly--; break;
case 7 : decalx--; decaly--; break;
}
//dprint(1, 1, "s:%d l:%d", planes[0].reload, planes[0].life);
switch(planes[0].dir)
{
case 0 : decalx--; break;
case 1 : decalx--; decaly++; break;
case 2 : decaly++; break;
case 3 : decalx++; decaly++; break;
case 4 : decalx++; break;
case 5 : decalx++; decaly--; break;
case 6 : decaly--; break;
case 7 : decalx--; decaly--; break;
}
dimage_part(planes[0].x, planes[0].y, &plane, 16*planes[0].dir, 0, 16, 16);
for(i = 1; i < MAX_PLANES; i++)
{
// dimage_part(planes[i].x + decalx, planes[i].y + decaly, &plane, 16*planes[i].dir, 0, 16, 16);
dimage(planes[i].x + decalx, planes[i].y + decaly, &plane);
dimage_part(planes[i].x + decalx, planes[i].y + decaly, &plane, 16*planes[i].dir, 0, 16, 16);
//dimage(planes[i].x + decalx, planes[i].y + decaly, &plane);
}
dprint(1,10, "(x,y)(%d,%d)", planes[1].x + decalx, planes[1].y + decaly);
dimage(10 + decalx, 10 + decaly, &cloud);
@ -158,8 +178,6 @@ int game()
timer_attach(timer, &update_frame, NULL);
timer_start(timer);
while(1)
{
multigetkey(keys, 3, 0);
@ -176,12 +194,33 @@ int game()
break;
}
case KEY_SHIFT : fire = 1; break; // fire enable
case KEY_SHIFT :
{
if(planes[0].reload > 0)
{
fire = 1;
// planes[0].reload = planes[0].reload - 1;
}
break; // fire enable
}
case KEY_EXIT :
{
timer_stop(timer); // virtual timer stopped
timer_destroy(timer); //destroy the virtual timer
return 1; // good bye, see you soon
}
// case KEY_OPTN :
// {
// timer_stop(timer); // virtual timer stopped
//
// infos();
//
// //timer = timer_create(40, 0);
// //timer_attach(timer, &update_frame, NULL);
// timer_start(timer);
// break;
// }
}
}

BIN
wings.bin Executable file

Binary file not shown.

BIN
wings.elf Executable file

Binary file not shown.

BIN
wings.g1a Normal file

Binary file not shown.