Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
games Posted by beardtrix on 14 Oct 2001 at 12:58 PM
i have an image that can move around etc. one thing i made it do was fire. this is the procedure:

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;

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.


Report
Re: games Posted by iby on 17 Oct 2001 at 6:47 PM
The idea is to run the whole game (or your FIRE) in a loop.
There are few aproaches so here is just an idea:


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.


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



Iby

Report
Re: games Posted by CroW on 4 Nov 2001 at 12:56 PM
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.



Report
Re: games Posted by Sand_Hawk9 on 7 Nov 2001 at 5:38 AM
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.


Report
Followup Posted by Nordquist on 9 Nov 2001 at 3:39 PM
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!!!





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.