Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Tetris-dropping shapes
Author Message
Neja

Posted: Thu May 20, 2004 4:34 pm   Post subject: Tetris-dropping shapes

Making Tetris for my final. I'm using 2-d arrays to set my blocks and grid up but the problem is that I really suck at it. I have no idea how to drop these "virtual shapes".

 code: var gridy, gridx : int := 30 % Grid. for counter : 1 .. 18     gridy := gridy + 20     Draw.Line (30, gridy, 230, gridy, 3) end for for counter : 1 .. 10     gridx := gridx + 20     Draw.Line (gridx, 30, gridx, 390, 3) end for proc SetUpBlock (var block : array 0 .. 3, 0 .. 3 of int)     /*      . []      . [][][]   0      .      . [][][]      . []       1      .      . [][]      . [][]     2      .      . [][][]      .   []     3      .      . [][][][] 4      .      . [][]      .   [][]   5      .      .   [][]      . [][]     6      .      .      */     for x : 0 .. 3         for y : 0 .. 3             block (x, y) := 0         end for     end for     var whatblock : int := Rand.Int (0, 6)     case whatblock of         label 0 :             block (0, 3) := 1             block (0, 2) := 1             block (1, 2) := 1             block (2, 2) := 1         label 1 :             block (0, 1) := 1             block (0, 2) := 1             block (1, 2) := 1             block (2, 2) := 1         label 2 :             block (0, 3) := 1             block (1, 3) := 1             block (0, 2) := 1             block (1, 2) := 1         label 3 :             block (0, 3) := 1             block (1, 3) := 1             block (2, 3) := 1             block (1, 2) := 1         label 4 :             block (0, 3) := 1             block (1, 3) := 1             block (2, 3) := 1             block (3, 3) := 1         label 5 :             block (0, 3) := 1             block (1, 3) := 1             block (1, 2) := 1             block (2, 2) := 1         label 6 :             block (0, 2) := 1             block (1, 2) := 1             block (1, 3) := 1             block (2, 3) := 1     end case end SetUpBlock

I already have the rotations finished (thanks to Martin). Here is what I have that I thought would work for dropping;

 code: for counter : 1 .. 4         for counter2 : 1 .. 4             if block (counter, counter2) = 1 then                 Draw.Fill (31 + (20 * counter), 369 - (20 * counter2), 3, 3)             end if         end for     end for

AsianSensation

Posted: Thu May 20, 2004 6:41 pm   Post subject: (No subject)

I PMed you the full code for a tetris game, dodge released it on some other site.

if you have any more questions, ask anytime.
Delta

Posted: Sun May 23, 2004 10:45 am   Post subject: (No subject)

Asian your just getting lazy now. Giving people complete source code? Your a lazy drunk. No offense and all
AsianSensation

Posted: Sun May 23, 2004 1:43 pm   Post subject: (No subject)

lol, it's ok, she's a friend of mine. So I figured I'll give her the source, and explain at school all the stuff, so I don't have to find the source code again.
Neja

Posted: Mon May 24, 2004 8:09 pm   Post subject: (No subject)

Wow, you're nicer online than in real life
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: