help with summative, due tomorrow
Author |
Message |
Wasabicheese
|
Posted: Tue Jun 02, 2009 1:58 pm Post subject: help with summative, due tomorrow |
|
|
My Game keeps freezing when you kill an enemy, and doesnt unfreeze until after you move. Can you guys help?
Description: |
|
Download |
Filename: |
program.zip |
Filesize: |
3.59 MB |
Downloaded: |
88 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Diablo117
|
Posted: Tue Jun 02, 2009 4:14 pm Post subject: Re: help with summative, due tomorrow |
|
|
In addition to that, your collision detection is off.
In response to your "freezing" it is in fact not really freezing
This part of the code is run if the blast is to the right of the screen, as the blast keeps moving and is not reset, the blast will always be past the right hand side of the screen until you move. In your movement part of code, you increase the blast X and Y, making the program run again.
if blastX (1) >= MonsterX (1) - movecount and blastX(2) <= MonsterX(2) - movecount and blastY (1) >= MonsterY (1) - movecount and blastY(2) <= MonsterY(2) - movecount then
Pic.Draw (explosion, 573 - movecount, 202 - movecount, picMerge)
delay (100)
kills := kills +1
MonsterX (1) := 570
MonsterY (1) := 200
MonsterX (2) := MonsterX (1) + Pic.Width (mypic2)
MonsterY (2) := MonsterY (1) + Pic.Height (mypic2)
drawfillbox (MonsterX (1) - 5, MonsterY (1) -5, MonsterX (2) + 5, MonsterY (2) +5, black)
end if
To prove my point, change this by commenting the movements of the blast out and run it. You will hopefully understand
if chars (KEY_DOWN_ARROW) and hp > 0 and MonsterX (2) >= 0 then
CharacterY (1) -= Speed
%blastX (1) := CharacterX (1) + 11
% blastY (1) := CharacterY (1) + 11
if chars (KEY_UP_ARROW) and hp > 0 and MonsterX (2) >= 0 then
CharacterY (1) += Speed
blastX (1) := CharacterX (1) + 11
blastY (1) := CharacterY (1) + 11
|
|
|
|
|
|
|
|