
-----------------------------------
ReCreate
Sat Nov 07, 2009 2:12 pm

Problem with manual collision checking
-----------------------------------
What is it you are trying to achieve?
Trying to get some collision checking to work...


What is the problem you are having?
The collision checking for the second object is not working 


Describe what you have tried to solve this problem
I read over it several times, Rewrote the if statement to check the collision several times, And even showed it to some friends if they would notice anything wrong. 


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

%collision checking
%this one does not work
        if maxx-40 > boxx and maxx-20 < boxx + 20 and otherplayerpaddlepos + 80 > boxy and otherplayerpaddlepos < boxy + 20 then
            Music.Sound (440, 50)
            yvelocity := -yvelocity
            xvelocity := -xvelocity
        end if

%this one does
        if 40 > boxx and 20 < boxx + 20 and playerpaddlepos + 80 > boxy and playerpaddlepos < boxy + 20 then
            Music.Sound (440, 50)
            yvelocity := -yvelocity
            xvelocity := -xvelocity
        end if



Please specify what version of Turing you are using
4.03

Ok so my problem is that for some reason, the first if statement for the collision checking does not work, I'm clueless, I read over it countless times And even rewrote it.
Any help would be greatly appreciated.
Thanks
~ReCreate

-----------------------------------
Tony
Sat Nov 07, 2009 2:38 pm

RE:Problem with manual collision checking
-----------------------------------
For what value of boxx will this be true?
[code]
if maxx-40 > boxx and maxx-20 < boxx + 20
[/code]

-----------------------------------
ReCreate
Sat Nov 07, 2009 2:51 pm

RE:Problem with manual collision checking
-----------------------------------
I don't get what you mean, Could you please rephrase that?

-----------------------------------
TheGuardian001
Sat Nov 07, 2009 4:15 pm

Re: Problem with manual collision checking
-----------------------------------

I don't get what you mean, Could you please rephrase that?


If you were to sub in every x value from 1 to maxx, which ones would make that statement true.

Let's take a look at your condition
[code]
if maxx-40 > boxx and maxx-20 < boxx + 20 
[/code]

Okay, now let's rearrange that a bit, to isolate boxx in both conditions. To do so, we'll subtract 20 from each side of the second condition. This gives us:

[code]
if maxx-40 > boxx and maxx-40 < boxx
[/code]

Which makes the problem a bit more obvious. Can you think of any number that is both less than and greater than maxx-40?

-----------------------------------
ReCreate
Sat Nov 07, 2009 5:23 pm

RE:Problem with manual collision checking
-----------------------------------
Well ummm... < and >'s tend to confuse me, I'm still not sure what the problem is, Do you mean that should do this instead?

if maxx-40 < boxx and maxx-40 > boxx 

The X never moves, But Boxx does...
Thanks
~ReCreate

-----------------------------------
Tony
Sat Nov 07, 2009 5:44 pm

Re: RE:Problem with manual collision checking
-----------------------------------
Well ummm... < and >'s tend to confuse me, I'm still not sure what the problem is
The problem is that comparison operators confuse you.

Here's a simple exercise for you to complete. We can't really move on until that is done.


Find all integer values of X such that

a) 0 < x and x < 4
b) 1 < x and x < 3
c) 2 < x and x < 2


-----------------------------------
ReCreate
Sat Nov 07, 2009 7:52 pm

RE:Problem with manual collision checking
-----------------------------------
Erm... Don't take this rude or anything, But you guys are strange...Usually you'd expect answers to be something more like " Well there's your problem! " or "You did  wrong the right way is ".
Well anyways, In the quote, What is the full question? It really doesn't make any sense.
What do they mean by "such that "?

-----------------------------------
Superskull85
Sat Nov 07, 2009 9:03 pm

RE:Problem with manual collision checking
-----------------------------------
What integer values of x would evaluate the given expression(s) to be true? 

Being able to evaluate expressions, and understand what statements are trying to tell you is probably the most important thing you need to know about computer science. If we just outright gave you the full solution you would not learn why, and how, your problem was fixed. Therefore you would probably not be able to solve a similar problem in the future.

-----------------------------------
ReCreate
Sat Nov 07, 2009 9:50 pm

RE:Problem with manual collision checking
-----------------------------------
*facepalms at perhaps the biggest misunderstanding in human history*
I know that, But just letting you know, I'm not here to learn about computer science(yet), I'm just here to get some help on turing. I know what you mean, and you are right, But I just want to know what it is that is wrong, that is all I care to know. (don't take this the wrong way)

-----------------------------------
TheGuardian001
Sat Nov 07, 2009 10:11 pm

Re: Problem with manual collision checking
-----------------------------------
Well, then you don't need anything here. Your problem is not a misunderstanding of Turing, it's a misunderstanding of how > and < work. Everything specific to Turing in this program (that you've shown us) is working, but if you don't understand how those work, you aren't going to get anywhere.

-----------------------------------
Superskull85
Sat Nov 07, 2009 10:51 pm

Re: RE:Problem with manual collision checking
-----------------------------------
...I'm not here to learn about computer science(yet), I'm just here to get some help on turing...
The problem is, like TheGuardian001 and Tony have stated, is that the only thing you don't understand is a general concept that can be applied to most high-level languages (including Turing). You say that you don't want to learn about computer science. However, every time you create a program you are in fact writing an implementation of one or more algorithms. Algorithms that can be created using computer science. When you debug code you are evaluating expressions (for example figuring out what the value of "-yvelocity" is), understanding a statement (for example understanding what "Music.Sound (440, 50)" does), understanding why you cannot store a boolean value in an int variable, etc. All of these tasks relate to computer science (and other software related disciplines) and are amongst the many things computer scientists are able to do.

I'll bet that if you can figure out the answer to the question Tony asked, and understand it, you will be able to solve the problem you are experiencing with your code. :)

-----------------------------------
ReCreate
Sun Nov 08, 2009 5:25 pm

RE:Problem with manual collision checking
-----------------------------------
Ok, what is strange is, I ported my program to C++ and it works... Well anyways, In the question "Find all integer values of X such that" I don't get what it is asking, could you rephrase it?
I know what < and > mean, I just sometimes forget what they are, like X and Y(I tend to forget what they are too >_ boxx and maxx-40 < boxx + 20 
Anyways, It works now, No thanks to you. *rolls eyes*

-----------------------------------
efan41
Thu Nov 12, 2009 3:02 pm

Re: Problem with manual collision checking
-----------------------------------
They're trying to say that you are trying to find an integer number between 40 and ................40.  :| Well you obviously haven't noticed that there isn't a single possible integer value between 40 and 40 seeing as integer values don't have decimals in them. And now that I think of it, you can't even have a decimal number between 40 and 40. :lol:  I'd like to see the supposedly fixed code to see if he actually fixed it or he's just tired of us pointing out what he dosen't understand.

-----------------------------------
ReCreate
Sun Nov 18, 2012 12:06 am

RE:Problem with manual collision checking
-----------------------------------
Well, I DID fix is. I posted the working game in some other thread all those years ago. Jeez I was a jerk, though. Apologies, humanity. :P
