More help needed with shooting game!
I still can''t figure what to do with my code for counting the shots but now i need some help with ammo. I want a label on the screen saying Ammo: 50 and everytime you click on the screen it takes off one ammo counting down until it gets to zero then it is gameover. Could someone please help me with this code, because without it i can''t make my game. Thanks in advance!
()<>()<>()<>()<>()<>()<>()<>()
()<>()<>()<>()<>()<>()<>()<>()
you don''t have the slightest idea about whatever language you are using, do you?
seriously, get a book about it.
seriously, get a book about it.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Please pay attention to what forum you are posting in. The For Beginners section sounds more appropriate for this, rather than Game Design, so I''ll move it there.
--------------------
Just waiting for the mothership...
--------------------
Just waiting for the mothership...
--------------------Just waiting for the mothership...
use c++, delphi sucks, anyway,here''s a code,that may help u:
is in "pseudo",cause i don''t like delphi,and i never use it,except for my first programming class,in school
countammo=50;
OnMouseClick()
{
countammo=countammo-1;
displayammo(countammo);
if countammo==0 then
gameover=TRUE; o replace it with the function to exit in delphi
}
again,try C++,is not that hard,if u follow an "incremental" learning: first C,then java,then C++,u can ommit java :D if u learn fast.
Note:i know,i know,my english sucks,anyway is not my mother language :D
is in "pseudo",cause i don''t like delphi,and i never use it,except for my first programming class,in school
countammo=50;
OnMouseClick()
{
countammo=countammo-1;
displayammo(countammo);
if countammo==0 then
gameover=TRUE; o replace it with the function to exit in delphi
}
again,try C++,is not that hard,if u follow an "incremental" learning: first C,then java,then C++,u can ommit java :D if u learn fast.
Note:i know,i know,my english sucks,anyway is not my mother language :D
quote: Original post by Serenic
I still can't figure what to do with my code for counting the shots but now i need some help with ammo. I want a label on the screen saying Ammo: 50 and everytime you click on the screen it takes off one ammo counting down until it gets to zero then it is gameover. Could someone please help me with this code, because without it i can't make my game. Thanks in advance!
()<>()<>()<>()<>()<>()<>()<>()
You need a variable to store the amount of ammo. You will need to place it outside of you procedure so that it is not lost when the procedure ends. Each time you fire a shot would use
Dec(Ammo);//Update display
Updating the display would depend on how you are displaying your graphics, some examples are as follows:
Using a label on your form:
AmmoLabel.Caption:='Ammo: '+IntToStr(Ammo);
Using a bitmap backbuffer that is blitted to the main form's canvas:
BackBuffer.Canvas.TextOut(10,10,'Ammo: '+IntToStr(Ammo));
Using DelphiX components:
with DXDraw1.Surface.Canvas dobegin TextOut(10,10,'Ammo: '+IntToStr(Ammo)); Release;end;
[edited by - michalson on July 23, 2002 10:55:37 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement