Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help with summative, due tomorrow
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Wasabicheese




PostPosted: 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?


program.zip
 Description:

Download
 Filename:  program.zip
 Filesize:  3.59 MB
 Downloaded:  88 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Diablo117




PostPosted: 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 Razz
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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: