
-----------------------------------
manyo2010
Tue Jun 11, 2013 11:28 pm

URGENT! Airplane Game Collision Detect!
-----------------------------------
What is it you are trying to achieve?
I'm trying to get the enemy airplane to detect the bullet and then exit.


What is the problem you are having?
The enemy airplane doesn't react to the bullet hitting it.


Describe what you have tried to solve this problem
The planeexit command works. But there is an issue where the program can't realize when to set planeexit to true. Maybe because of multi threading.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Please specify what version of Turing you are using
4.1.1

-----------------------------------
Tony
Wed Jun 12, 2013 12:21 am

RE:URGENT! Airplane Game Collision Detect!
-----------------------------------
You have 4 different exit flags

var planeexit1, planeexit2, planeexit3, planeexit4 : boolean 

and each is checked 6 or 7 times (quite actually, planeexit2 and planeexit3 are checked 7 times each, while planeexit1 and planeexit4 are checked "only" 6 times) if some loop should end.

Can you reason about the state of the game's world, for all 26 of those conditions, while shuffling the control flow around via processes? That seems difficult. You should at least log the states to help you make sense of what's going on. E.g.

[code]
if planeexit3 = true then 
put "planeexit3 is true for the 5th time, now exiting"
exit 
end if 
[/code]

Although since you are also drawing stuff to the screen, you might want to "put" that into a log file instead.

-----------------------------------
manyo2010
Wed Jun 12, 2013 8:14 am

Re: RE:URGENT! Airplane Game Collision Detect!
-----------------------------------
You have 4 different exit flags

var planeexit1, planeexit2, planeexit3, planeexit4 : boolean 

and each is checked 6 or 7 times (quite actually, planeexit2 and planeexit3 are checked 7 times each, while planeexit1 and planeexit4 are checked "only" 6 times) if some loop should end.

Can you reason about the state of the game's world, for all 26 of those conditions, while shuffling the control flow around via processes? That seems difficult. You should at least log the states to help you make sense of what's going on. E.g.



I actually set the standard values for the planeexit commands to true in the beginning, and all of the  planes did not show up. So I don't think its a problem of the planes not working on the command. I have it checking the planeexit command so often because I want to be sure that the plane actually exits. I did what you told me to do, and added a put command whenever the bullet is supposed to hit the airplane, and only one airplane showed that put command. The rest did not for some reason.

-----------------------------------
Tony
Wed Jun 12, 2013 12:32 pm

Re: RE:URGENT! Airplane Game Collision Detect!
-----------------------------------
I did what you told me to do, and added a put command whenever the bullet is supposed to hit the airplane, and only one airplane showed that put command. The rest did not for some reason.
That's very good, in a way that you are getting much closer to the root of the problem. Now, what's different in the code between the plane that works and one that doesn't?
