Originally Posted by
jasonf
I think things are getting confusing because you're using -10 and counting up. But the test in UpdateShields is checking if shields <0> 0
I feel that this is the wrong way around. Things which are being damaged should lose value. Good things should be positive, bad things should be negative.
It is done like you say. The Inc procedure in TPlayer.UpdateShields increases or decreases player's shields depending on the sign of the passed value. That is why the BOMB_DAMAGE is set to negative value.
Originally Posted by
Wizard
Should FShields and amount have values assigned to them?
Each time you initialize player (TForm1.PlayerCreate procedure) you must set FShields to some initial value. The class constructor sets all integer fields to zero by default and that is why first bomb destroys the player.
Originally Posted by
Wizard
The following is called in the DXTimer event:
Code:
if (Player.Deaded) then
NewPlayer
else
GameEnd;
I think this is not right but I might be wrong since I dont know the GameEnd procedure. I understand this if statement like this.
If player is destroyed create new player, if it is not then end game.
I would do that like this:
Code:
if Player.deaded then begin
if Lives > 0 then //if there are lives left create new player
NewPlayer
else //if not end the game
GameEnd;
end;
//continue with the game
Bookmarks