games

i have an image that can move around etc. one thing i made it do was fire. this is the procedure:
[blue]
procedure fire;
begin
a:=x+5;
b:=y+2;
repeat

background;
putico (x,y,picture1,vaddr);
putenemy(g,h,baddy,vaddr);
funny_line(a,b,a+5,b,4,vaddr);

a:=a+5;

waitretrace;
flip(vaddr,vga);
rotatepal;

if (a=g) and (b=h+2) then
begin

background;
funny_line(a,b,a+5,b,0,vaddr);
putico (x,y,picture1,vaddr);
putdesten(g,h,destroy,vaddr);
waitretrace;
flip(vaddr,vga);
rotatepal;

win;
end;

until a=300;

background;
putico (x,y,picture1,vaddr);
putenemy(g,h,baddy,vaddr);
funny_line(a,b,a+5,b,0,vaddr);
waitretrace;
flip(vaddr,vga);
rotatepal;

end;
[/blue]
if you need me to explain any ask.

When i press F it runs this procedure but everything else stops until the procedure has run (ie, when the line reaches the end of the screen or hits the enemy).

what i want to be able to do is fire the line and still be able to move around or maybe fire another line.

i'm using 320*200.

thanks.


Comments

  • The idea is to run the whole game (or your FIRE) in a loop.
    There are few aproaches so here is just an idea:


    [code]
    begin
    initialize;
    set_mode;
    get_some_memory;
    load_sprites;
    repeat
    display_background;
    put_all_sprites;
    if fire_button_pressed then FIRE;
    if (fast_PC=true and disable_sound=false) then play_some_noise;
    vsync;
    flip_pages;
    until i_gotta_quit=true;
    set_text_mode;
    return_memory;
    end.
    [/code]

    You will find plenty examples on the net or this board.
    Email me if you need some code...



    Iby

  • another way is to chain into interrupt 09h (keyboard int.)Then check the keyboardbuffer for keypresses and do the needed action in the new Int09h-procedure.



  • Try this:

    If the FIRE procedure is called a variable in the main game loop is set to the position of the line. Then leave the procedure and return to the game loop. Run all normal thingies in the game loop and make somewhere a checkup for the var. If the var differs from -99 then it's set and you need to move it one position up/down/left/right or whatever. After you changed one position of the line draw it on the screen and return with the loop. In the check routine you just see if it hits an enemy or goes out of sight. If both happen you set the var to -99(no bullet) and remove it from the display. If you don't get the point send me an e-mail at sand_hawk9@hotmail.com and i'll explain a bit better. At this moment my time is very limited.

    Good Luck with you're attempt,

    Sand Hawk

    - Earth is 98% full. Please delete anybody you can.


  • This made me wonder about something I don't know how to accomplish, read the "No max number of shots at the same time"-thread to see what I mean.
    ******
    It is a good shrubbery, but we are no longer the Knights Who Say NI !!

    Shhhh...

    We are now the knights who say icky icky icky icky p'clang zoom boing enzown!!!


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories