Guess who's back!
I'm almost done with the game, I still have to finish the movement for the enemies, their shooting and as always, fix the freaking bugs! I managed to get around the shooting function for the spaceship, and I am pleased to announce that I did not have to use an array or a record for such action. All I did was declare two separate variables containing the x,y coordinates of the ship and then applying them to the 2D array.
Now here's the problem: I can't make the ship shoot and move at the same time, meaning that until you press the space bar, the ship won't move unless the bullet is drawn on the screen... Could it be because I am calling the readkey and keypressed functions from two different procedures? (One to move the ship and the other to shoot).
Here's some of the code, mainly the shooting procedure and the moving one:
Code:
procedure crear_bala(variable_dario_x,variable_dario_y:byte;var bala_x,bala_y:byte;var puntaje : integer; var Poder_Disparar : boolean; var matriz : tm_matriz; var punta_a:byte);
Begin

if keypressed then
 begin
 if (not Poder_Disparar) and (readkey = spacebar) then
  
	 	 begin
     Poder_Disparar := true;
     bala_x:=punta_a;
     bala_y:=37; {variable que tomo del proc de dario}
	  end;
  end;

 IF (Poder_Disparar) and (bala_y>1) THEN
  begin
   dec(bala_y);
   if ((matriz[bala_x,bala_y]<>'M') and (matriz[bala_x,bala_y]<>'R')
      and (matriz[bala_x,bala_y]<>'^')) then
    begin
     matriz[bala_x,bala_y] := 'I';
     gotoxy(bala_x,bala_y);
     write(matriz[bala_x,bala_y]);
     if matriz[bala_x,bala_y+1]='I' then
      begin
       matriz[bala_x,bala_y+1]:=' ';
       gotoxy (bala_x,bala_y+1);
       write (matriz[bala_x,bala_y+1]);
      end;
    end;
BTW that's for the bullet, it's in spanish i know... crear_bala = bullet creation poder_disparar = canshoot
And for the movemente:
Code:
procedure Mover_Nave(var matriz: tm_matriz; var punta_d, punta_i, punta_a: byte; var tecla:char);
var
    fil, col, i: byte;
begin
    i:=0;
    if (tecla='d') then
        begin
        col:=punta_d;
        for fil:=38 downto 36 do
            begin
            while (matriz[col,fil]='^') do
                begin
                int(matriz[col,fil],matriz[col+1,fil]);
                gotoxy(col+1,fil);
                write(matriz[col+1,fil]);
                gotoxy (col,fil);
                write (matriz[col,fil]);
                dec(col);
                end;
            inc(i);
            col:=punta_d-i;
            end;
        inc(punta_d);
        inc(punta_i);
        inc(punta_a);
        end;
    i:=0;
    if (tecla='a') then
        begin
        col:=punta_i;
        for fil:=38 downto 36 do
            begin
            while (matriz[col,fil]='^') do
                begin
                int(matriz[col,fil],matriz[col-1,fil]);
                gotoxy(col-1,fil);
                write(matriz[col-1,fil]);
                gotoxy (col,fil);
                write (matriz[col,fil]);
                inc(col);
                end;
            inc(i);
            col:=punta_i+i;
            end;
        dec(punta_d);
        dec(punta_i);
        dec(punta_a);
        end;
end;
MAIN LOOP this is where I need help also...
Code:
begin
 dis_mars_fil:=6;
 dis_mars_col:=6;
 clrscr;
 perdiste:=false;
 colicion:=false;
 hay_tiro:=false;
 cant_vidas:=3;
 cargar(m_matriz,punta_marcianos_x,punta_marcianos_y);
 mostrar(m_matriz);
 cargar_nave(m_matriz,pd,pi,pa);
 vida (m_matriz);
 gotoxy (1,2);
 write('012345678901234567892123456789312345678941234567895123456789612345678971234567');

 while not perdiste do
  begin
   delay(50);
   resta_vida (colicion,cant_vidas,perdiste,m_matriz);
   p_disparo_marciano (m_matriz,hay_tiro,colicion,punta_marcianos_x,filnav,punta_marcianos_y,colnav,x_bala,y_bala);
		crear_bala(variable_dario_x,variable_dario_y,bala_x,bala_y,puntaje,Poder_Disparar,m_matriz,pa);
   if keypressed then
            begin
            teclapresionada:=readkey;
								mover_nave(m_matriz, pd, pi, pa, teclapresionada);
            end;


  end;
end.
All variables are declared correctly, I just need help with the keypressed and readkey functions. I only posted the code I need help with cause the rest is too long...
Please help me! I need to finish this by Thursday or im screwed! THANK YOU ALL
PS Is it possible to attach a file?