Turing-drawn graphics as background
Author |
Message |
ScribbleS
|
Posted: Sat Nov 08, 2008 3:35 pm Post subject: Turing-drawn graphics as background |
|
|
I'm not sure if anyone has asked a similar question, but i'll take my chances... xD
recently, i've been quite bored and had started trying to recreate the classic game of Tetris on Turing. so far I've achieved next to nothing, except drawing the seven shapes, randomizing which will appear, and getting them to move using arrow keys and "gravity". I'm very inexperience with Turing (I've only heard of it like 2 months ago in class), but i've done a little (very little) with Java before. Basically, my problem is that I don't know what i should use to keep the shape there AND make another appear, so on so forth. All graphics are drawing using the program itself (i.e. drawbox, drawfillbox, etc.). Can anyone enlighten me??
p.s.: i've also been thinking of how i can get the other shapes to stop when they "collide" with the shapes on the bottom. If anyone can help me with that i'll be very grateful too  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Insectoid

|
Posted: Sat Nov 08, 2008 4:06 pm Post subject: RE:Turing-drawn graphics as background |
|
|
Hold the X and Y values in a flexible array and as new pieces come down, add increase the size of the array by 1. Use a for loop to draw everything, and you're good! |
|
|
|
|
 |
ScribbleS
|
Posted: Sat Nov 08, 2008 4:18 pm Post subject: Re: Turing-drawn graphics as background |
|
|
Thank you!
However, you seem to have forgotten that i am extremely noob at this. any pointers which tutorial i should look at? i searched flexible array but haven't found any useful matches.
i think i have an idea for the collision thing tho ;D |
|
|
|
|
 |
Insectoid

|
Posted: Sat Nov 08, 2008 4:20 pm Post subject: RE:Turing-drawn graphics as background |
|
|
the Turing Walkthrough. nearly everything you will ever need (turing-wise) is in there. Part 3 of the array tutorial is about flexible arrays. There is a whole tutorial for collision detection. |
|
|
|
|
 |
ScribbleS
|
Posted: Sat Nov 08, 2008 5:32 pm Post subject: Re: Turing-drawn graphics as background |
|
|
I found the tutorial very helpful, but again i am hit with new problems.
when ever i run the program, it says "Array subscript is out of range" after the first piece lands. I know this is because i declared the variable a (which i used in limiting the arrays x and y) as one up top, and my procedures naturally function as if a is a const that equals to 1, so when i say a:=a+1 in the loop the value of a exceeds 1 (duh, that's what i'm trying to do...). the problem is i can't figure out how to fix it.
...help...(screams hoarsely) |
|
|
|
|
 |
syntax_error

|
Posted: Sat Nov 08, 2008 5:36 pm Post subject: RE:Turing-drawn graphics as background |
|
|
Why, use a flexible array? a finite or normal array is sufficient. Perhaps even easier to use. Have the array set to null, each time one element has a block change the null to w.e number you want [ if you want only certain colours to come together for bonus points et certera each colour gets a set value and so on ]. |
|
|
|
|
 |
|
|