Jump to content

Recommended Posts

Posted (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 by Umpa

Posted

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.

Posted

@ Umpa

I have removed, your ignorant reply, please answer your previous responder if you wish to receive further help!

Posted

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.

Posted

yeah ill get one of the form but i wont bother with the code because there isnt much there and its probly wrong :unsure:

is there any code u know to hide an image after a certain amount of time?

Posted

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.

form.jpg

Posted

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. :(

Posted

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)

Posted

almost works but it flashes on and off over and over, i just want it to flash up once and then dissapear again.

Posted
but it flashes on and off over and over

Yes, I know. It was just an example. It wasn't intended to do your program for you. :whistle:

Posted

well ive not used the tool much before so i wont be able to work it out myself :P, 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 :/

Posted (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 by FAT64

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...