Umpa Posted June 3, 2007 Posted June 3, 2007 (edited) I am currently making a very very simple game, it doesnt need to be great but it needs to work and im having problems finding the code for some things. I have an image which is a target, it moves around the screen and i have a much smaller image which is a crosshair(stays in the middle of the screen), i also have a button which is suposed to be the shoot button.I have made a small image appear when i click the button but i need to make it disapear very quickly after, i need this to appear and disapear everytime i click the button, this is the first thing i need help with. Secondly i need to increase a variable i called score by 1 everytime the button is clicked while the crosshair is over the target. Very simple i know but im really not a good programer and need help with the code, thanks Re: This is in delphi Edited June 3, 2007 by Umpa
ripken204 Posted June 3, 2007 Posted June 3, 2007 what language are you doing?do you have an environment class?i recently made a space invaders game in java, so it sounds almost exactly like what you are trying to do.the score counter would have to be a variable in the environment class.every object need to be in the environment.you will need to make a new method and a die method for everything you have.
Yzöwl Posted June 3, 2007 Posted June 3, 2007 @ UmpaI have removed, your ignorant reply, please answer your previous responder if you wish to receive further help!
Umpa Posted June 4, 2007 Author Posted June 4, 2007 sorry that looked bad, we did speak through pm but he couldnt help me as he hasnt used delphi, if anyone else can help, please do.
FAT64 Posted June 4, 2007 Posted June 4, 2007 Any possibility of uploading the code you have already and a screen shot of your form?
Umpa Posted June 4, 2007 Author Posted June 4, 2007 yeah ill get one of the form but i wont bother with the code because there isnt much there and its probly wrong is there any code u know to hide an image after a certain amount of time?
Umpa Posted June 4, 2007 Author Posted June 4, 2007 right, dont have it with me like i thought i did but here is what it looked like, very simple, begin button starts the target moving and shoot is suposed to add to score if the circle is over the target but i cant find out how to tell if the target is the same position as the crosshair.
FAT64 Posted June 4, 2007 Posted June 4, 2007 To hide an image after a certain amount of time, simply use a "Timer" object.
Umpa Posted June 4, 2007 Author Posted June 4, 2007 i tried that but i couldnt get it to work :S could u tell me what code to put in the timer? if any, or do i just change properties or somethin, as i said im really not very good with delphi, sorry.
FAT64 Posted June 4, 2007 Posted June 4, 2007 Put a Timer object on your Form (from the System palette), double-click it and if you type the following ...Image1.Visible := not Image1.Visible... it will make the Image flash on and off in 1 second (1000 millisecond) intervals. (Assuming that in Delphi 6, a Timer is enabled by default - I only have Delphi 7)
Umpa Posted June 5, 2007 Author Posted June 5, 2007 almost works but it flashes on and off over and over, i just want it to flash up once and then dissapear again.
FAT64 Posted June 6, 2007 Posted June 6, 2007 but it flashes on and off over and overYes, I know. It was just an example. It wasn't intended to do your program for you.
Umpa Posted June 6, 2007 Author Posted June 6, 2007 well ive not used the tool much before so i wont be able to work it out myself , i messed about with the code and tried somethin like, if image is visible do image.hide but that didnt work either, meh i dunno :/
FAT64 Posted June 6, 2007 Posted June 6, 2007 (edited) Can you describe how your game is supposed to work in as much detail as possible and I'll see what I can do. Edited June 6, 2007 by FAT64
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now