Hello,
I have a program - it is accually a game, BoulderDash. A man runs an collets some crystals and when he has already collected the needed amount of crystals, he goes to the given destination and goes to another level. In the game besides the crystals there are also stones. When a stone or a crystal falls on the man's head, the game is over. The stone or crystal cannot fall from the grass or wall, but from another stone or crystal it can fall to the right or to the left.
Now I have made the program, I have the man moving across the game field, he collets the crystals, the stones are falling too. But there is a problem, when the man goes under the stone, this stone moves only when the man is moving, to steps with the man (I don't know if this is correct english, I hope you'll understand). So it is impossible to kill the man, because the man MUST go a step somewhere else, so that the stone can move a tile further.
I would like to make such thing, when the man goes under the stone, the stone falls abstractedly from the man. I want to use Timer, but I think, there's a little more needed, because the current operation, which is actually executing, must be suspended in a moment, when the player pushes some arrow. And I think, that javax.swing.Tim er takes all the events and enqueques them into the queue of events, so they all will be accomplished. I need only the current event to be accomplished, and if there is some executing, it must be suspended.
I don't know how to do it, can somebody help me? Please..
I have a program - it is accually a game, BoulderDash. A man runs an collets some crystals and when he has already collected the needed amount of crystals, he goes to the given destination and goes to another level. In the game besides the crystals there are also stones. When a stone or a crystal falls on the man's head, the game is over. The stone or crystal cannot fall from the grass or wall, but from another stone or crystal it can fall to the right or to the left.
Now I have made the program, I have the man moving across the game field, he collets the crystals, the stones are falling too. But there is a problem, when the man goes under the stone, this stone moves only when the man is moving, to steps with the man (I don't know if this is correct english, I hope you'll understand). So it is impossible to kill the man, because the man MUST go a step somewhere else, so that the stone can move a tile further.
I would like to make such thing, when the man goes under the stone, the stone falls abstractedly from the man. I want to use Timer, but I think, there's a little more needed, because the current operation, which is actually executing, must be suspended in a moment, when the player pushes some arrow. And I think, that javax.swing.Tim er takes all the events and enqueques them into the queue of events, so they all will be accomplished. I need only the current event to be accomplished, and if there is some executing, it must be suspended.
I don't know how to do it, can somebody help me? Please..
Comment