Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Removing data from an array

Author
Message
Jac
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location:
Posted: 3rd Oct 2004 03:30
Working on a tutorial exercise that wequired me to know when 3 boxes are on top of each other. I'm using an array to store the data telling me which boxs overlap but when I mover the boxes away from each other the data stays in the array on some occations but not on others.

in the snippet below is the bit of code I'm using at the moment



and below I have place the whole of the code for the program.

I would be grateful if I could be pointed in the direction of a solution.

Thanks

JC
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Oct 2004 11:00
DBP doens't like if (this or this) and (this or this) type checking.
You will probably have to break it down into individual checks. If you will notice with your code the values reset quickly if the boxes move away from the side instead of up or down.

Jac
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location:
Posted: 3rd Oct 2004 17:16
I see, I'll try breaking it down.

I did notice that sometimes the code values were reseting but didn't spot the pattern.

Thanks, I'd have never have worked this one out on my own.
Jac
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location:
Posted: 3rd Oct 2004 19:31
So I broke down my if statements to see if that worked. Unfortunately the same issue arose. So I went back to my original set of if statement.



As 'Lost in Thought' pointed out (thanks again) that when the boxes move over each other from side to side it works correctly but not from bottom or top. I realized that these two actions were dealt with by separate 'if' statements. I then realized that I only had one 'else' statement so I added a second 'else' statement as shown below,



and it now works.

Just thought I'd write it up if anyone was interested.

JC
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th Oct 2004 00:02
Glad you got it working.

Login to post a reply

Server time is: 2024-09-23 02:28:34
Your offset time is: 2024-09-23 02:28:34