Posted: Sat Nov 07, 2009 2:12 pm Post subject: 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)
Turing:
%collision checking %this one does not work if maxx-40 > boxx and maxx-20 < boxx + 20and otherplayerpaddlepos + 80 > boxy and otherplayerpaddlepos < boxy + 20then Music.Sound(440, 50)
yvelocity := -yvelocity
xvelocity := -xvelocity
endif
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
Sponsor Sponsor
Tony
Posted: Sat Nov 07, 2009 2:38 pm Post subject: RE:Problem with manual collision checking
Posted: Sat Nov 07, 2009 2:51 pm Post subject: RE:Problem with manual collision checking
I don't get what you mean, Could you please rephrase that?
TheGuardian001
Posted: Sat Nov 07, 2009 4:15 pm Post subject: Re: Problem with manual collision checking
ReCreate wrote:
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
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
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
Posted: Sat Nov 07, 2009 5:23 pm Post subject: 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
Posted: Sat Nov 07, 2009 5:44 pm Post subject: Re: RE:Problem with manual collision checking
ReCreate @ Sat Nov 07, 2009 5:23 pm wrote:
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.
Quote:
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
Posted: Sat Nov 07, 2009 7:52 pm Post subject: 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 "<code> Well there's your problem! <fixed code>" or "You did <something> wrong the right way is <something>".
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
Posted: Sat Nov 07, 2009 9:03 pm Post subject: 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.
Sponsor Sponsor
ReCreate
Posted: Sat Nov 07, 2009 9:50 pm Post subject: 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
Posted: Sat Nov 07, 2009 10:11 pm Post subject: 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
Posted: Sat Nov 07, 2009 10:51 pm Post subject: Re: RE:Problem with manual collision checking
ReCreate @ Sat Nov 07, 2009 9:50 pm wrote:
...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
Posted: Sun Nov 08, 2009 5:25 pm Post subject: 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 >_<).
Superskull85
Posted: Sun Nov 08, 2009 5:27 pm Post subject: Re: RE:Problem with manual collision checking
ReCreate @ Sun Nov 08, 2009 5:25 pm wrote:
...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?...
What integer values of x would evaluate the given expression(s) to be true?
Tony
Posted: Sun Nov 08, 2009 5:36 pm Post subject: RE:Problem with manual collision checking
For example:
1 < x
1 is less than 2, so "1 < 2" is true. 1 is also less than 3, 4, 5...