Computer Science Canada lightBike help |
Author: | evildaddy911 [ Mon Nov 07, 2011 4:04 pm ] |
Post subject: | lightBike help |
What is it you are trying to achieve? basic lightbikes program What is the problem you are having? im having trouble adding a powerup that makes your trial longer, the 'shift' procedure says "array subscript is out of range" Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) see below Please specify what version of Turing you are using 4.1.1 |
Author: | Zren [ Mon Nov 07, 2011 5:16 pm ] | ||
Post subject: | RE:lightBike help | ||
What happens when the players lightbike's trail is longer than the computers? Eg: y : array 1..60 y2 : array 1..50 |
Author: | evildaddy911 [ Mon Nov 07, 2011 5:55 pm ] | ||||
Post subject: | Re: lightBike help | ||||
it crashes, so i changed it to
but it still crashes and points to the drawing trail part. i did the same thing to it:
now it works, thanks a lot! |
Author: | Zren [ Tue Nov 08, 2011 2:04 am ] | ||
Post subject: | RE:lightBike help | ||
Just so you know, there's no reason you can't use the same variable name for each of the for loops. The variable is only decalared in the scope of the loop. Example:
That is perfectly legal code, as the variable i has been undeclared as it leaves the scope of the for loop. A coding standard is to use i as a counter instead of a random variable name if nothing is more suitable (Eg: x, and y would be more suitable if looping over a all pixels on the screen). |