program redwar;
global
struct j[2]
x,y,graph;
size,angle;
shot;
end
yo,myfont;
begin
load_fpg("steroid/steroid.fpg");
myfont=load_fnt("red.fnt");
set_mode(m640x480);
set_fps(35,4);
net.device=0; // TCP/IP
net.num_players=2;
net.max_players=2;
yo=net_join_game("MyGame",&j,sizeof(j));
if (yo<0) exit("Error...",yo); end
player(yo);
enemy(1-yo);
end
process player(i)
begin
x=640*i;
angle=i*pi;
y=240;
graph=1;
write(myfont,0,0,0,"Game ID:");
write_int(myfont,100,0,0,&net.com);
write_int(myfont,0,20,0,&net.server);
write_int(myfont,0,40,0,&yo);
loop
if (key(_right)) angle-=15000; end
if (key(_left)) angle+=15000; end
if (key(_up)) advance(8); end
if (key(_space))
shot(x,y,angle);
j[i].shot=1;
else
j[i].shot=0;
end
j[i].x=x;
j[i].y=y;
j[i].angle=angle;
j[i].size=size;
j[i].graph=graph;
frame;
end
end
process shot(x,y,angle)
begin
graph=2;
advance(24);
repeat
advance(16);
frame;
until (out_region(id,0));
end
process enemy(i)
begin
loop
x=j[i].x;
y=j[i].y;
graph=j[i].graph;
size=j[i].size;
angle=j[i].angle;
if (j[i].shot)
shot(x,y,angle);
j[i].shot=0;
end
frame;
end
end
|