Computer Science Canada JezzBall |
Author: | Mr. T [ Mon Sep 19, 2005 5:55 pm ] | ||||
Post subject: | JezzBall | ||||
This section of code doesn't seem to work properly.
What this section of code is supposed to do is cancel the creation of a bar if it intersects with a previously created wall. For some reason this only works in certain instances. Any ideas why? Here's the entire code.
|
Author: | beard0 [ Mon Sep 19, 2005 6:53 pm ] |
Post subject: | |
I was wondering when this would show up again :P I think I need some info at this point on what you want the overall program to do. Also, with this much code, please post it as an attachment. |
Author: | Mr. T [ Mon Sep 19, 2005 7:09 pm ] | ||
Post subject: | Alex's Opinion | ||
This segment of code
should interrupt the creation of a new bar if it detects that it has hit a previously existing bar. For some reason this only happens in certain instances. Test it out and see for yourself. |
Author: | beard0 [ Mon Sep 19, 2005 7:12 pm ] |
Post subject: | |
Yep, I got that. I want to know what the overal program does, or rather, will do eventually. |
Author: | Mr. T [ Mon Sep 19, 2005 7:13 pm ] |
Post subject: | Alex's Opinion |
well have u ever played the real jezzball before? |
Author: | beard0 [ Mon Sep 19, 2005 7:18 pm ] |
Post subject: | |
well, obviously, no, or I wouldn't be asking. |
Author: | Mr. T [ Mon Sep 19, 2005 7:38 pm ] |
Post subject: | Alex's Opinion |
You could have just said that from the get-go. I'm to tired to infer what you are implying. Here's an online version. It's in spanish but wont hinder ur game play. It shouldnt take too long to figure out either. http://www.bolaloca.com/way/cool/bl/s_play.html |
Author: | wtd [ Mon Sep 19, 2005 7:44 pm ] | ||
Post subject: | Re: Alex's Opinion | ||
Pwned wrote:
Bad, bad programmer! ![]() You should know where on the screen any bars are, and at any given time where balls are. Then it's a reasonably simple matter to determine if they're colliding. |
Author: | beard0 [ Mon Sep 19, 2005 7:57 pm ] |
Post subject: | |
Okay, I got you now ;) So, the problem is that your not resseting your barInterrupt variable to true everywhere you should be. On top of which, you really shouldn't need to use that variable anyway, just put the code that you have in the if barInterrupt blah blah blah... later in this area, under the appopriate section of your if construct. wtd is one of the people I was talking about earlier who scoffs at the whatdotcolor collision detection, and, right as he is, it can be quite uesful, especially when you are a less experienced programmer. |
Author: | Mr. T [ Mon Sep 19, 2005 8:00 pm ] | ||
Post subject: | Re: Alex's Opinion | ||
wtd wrote: Pwned wrote:
Bad, bad programmer! ![]() Not very supportive. ![]() |
Author: | Mr. T [ Mon Sep 19, 2005 8:01 pm ] |
Post subject: | Alex's Opinion |
beard0 wrote: So, the problem is that your not resseting your barInterrupt variable to true everywhere you should be.
where should it be? |
Author: | beard0 [ Mon Sep 19, 2005 8:08 pm ] |
Post subject: | |
well, your code is pretty messy. Rather than asking that, I was hoping that you would go with the later part of what I was saying, and not use the boolean variable at all. |
Author: | Mr. T [ Mon Sep 19, 2005 8:15 pm ] |
Post subject: | Alex's Opinion |
Ok i took it out like u said, but im still getting the same result ![]() |
Author: | [Gandalf] [ Mon Sep 19, 2005 8:19 pm ] |
Post subject: | Re: Alex's Opinion |
wtd wrote: You should know where on the screen any bars are, and at any given time where balls are. Then it's a reasonably simple matter to determine if they're colliding.
I agree, but if you are looking for more speed (Turing-wise) then whatdotcolour would be better (if it is sufficient for the program), since instead of checking each bar against each bar it would only check for a colour once in the whole 'frame'. Pwned, you took out the variable, now do the next step... beard0 said it already (although slightly 'blahish'). |
Author: | Mr. T [ Mon Sep 19, 2005 8:24 pm ] |
Post subject: | |
The second part of what beard0 said was... beard0 wrote: just put the code that you have in the if barInterrupt blah blah blah... later in this area, under the appopriate section of your if construct.
but if i already took out the barInterrupt variable, how can i do this? |
Author: | beard0 [ Mon Sep 19, 2005 8:30 pm ] |
Post subject: | |
You need to put the code that should stop the bar moving, within the if construct which detects the blue dot (i.e. collision). Sorry, I know I wasn't very clear before. |
Author: | Mr. T [ Mon Sep 19, 2005 8:35 pm ] | ||
Post subject: | Alex's Opinion | ||
i think that's what i tried to do in...
because if whatdotcolour detects blue, then the current position of barX remains stationary in the form of barXStore1. But for some reason this still isn't working. |
Author: | wtd [ Mon Sep 19, 2005 11:27 pm ] |
Post subject: | Re: Alex's Opinion |
[Gandalf] wrote: wtd wrote: You should know where on the screen any bars are, and at any given time where balls are. Then it's a reasonably simple matter to determine if they're colliding.
I agree, but if you are looking for more speed Doing something wrong fast isn't necessarily good. ![]() |
Author: | wtd [ Mon Sep 19, 2005 11:28 pm ] | ||
Post subject: | Re: Alex's Opinion | ||
Pwned wrote: wtd wrote: Pwned wrote:
Bad, bad programmer! ![]() Not very supportive. ![]() You should have read past that. |
Author: | [Gandalf] [ Tue Sep 20, 2005 3:57 pm ] |
Post subject: | Re: Alex's Opinion |
wtd wrote: Doing something wrong fast isn't necessarily good.
![]() Sure, but it is the only way around it if you have a quite large Turing program. It's a solution, not a good one, but a solution. |
Author: | wtd [ Tue Sep 20, 2005 4:02 pm ] |
Post subject: | |
If it isn't a good practice, then are you really sure it's a solution at all? ![]() |
Author: | beard0 [ Tue Sep 20, 2005 4:08 pm ] |
Post subject: | |
wtd wrote: If it isn't a good practice, then are you really sure it's a solution at all? :)
That would depend entirely on the situation. Let's say that you needed to write a program that needed to use very little memory, and you wanted to cut any corners you could; this would make whatdotcolour a great solution, though still not a good practice. For a very real life example, I was working in a laser lab over the summer, and had to do up some assembly. My code was next to incomprehensible - but it got the loop done in the required 17 instruction cycles for the experiment to work. There are always circumstances... |
Author: | Mr. T [ Tue Sep 20, 2005 4:27 pm ] |
Post subject: | Alex's Opinion |
Can we stop pondering about the mysteries of life and start helping me with what I already have? ![]() |
Author: | beard0 [ Tue Sep 20, 2005 4:30 pm ] |
Post subject: | |
Woah! Calm down there. It's not like you're paying us to help you, were doing this for free, and if something interesting comes up, we'll discuss it. In terms of your problems, it looks like you are detecting collisions on the right side of your wall only. |
Author: | wtd [ Tue Sep 20, 2005 4:35 pm ] |
Post subject: | |
Indeed. If solving one problem does not in turn raise at least one new issue, then you're not doing it right. Especially in programming, there's no such thing as a clean solution in that sense. |