<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://love2d.org/forums/feed.php?f=4" />

<title>LÖVE</title>
<link href="http://love2d.org/forums/index.php" />
<updated>2015-01-25T21:50:52+00:00</updated>

<author><name><![CDATA[LÖVE]]></name></author>
<id>http://love2d.org/forums/feed.php?f=4</id>
<entry>
<author><name><![CDATA[Bindie]]></name></author>
<updated>2015-01-25T21:50:52+00:00</updated>
<published>2015-01-25T21:50:52+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179404#p179404</id>
<link href="http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179404#p179404"/>
<title type="html"><![CDATA[Support and Development • Re: &quot;Questions that don't deserve their own thread&quot; thread]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179404#p179404"><![CDATA[
<dl class="codebox"><dt>Code: </dt><dd><code>x =  floor( player.y / TILEHEIGHT ), y = floor( player.x / TILEWIDTH )</code></dd></dl><br /><br />If I understood you correctly, is this what you showed?<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136234">Bindie</a> — Sun Jan 25, 2015 9:50 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[S0lll0s]]></name></author>
<updated>2015-01-25T21:37:59+00:00</updated>
<published>2015-01-25T21:37:59+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179402#p179402</id>
<link href="http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179402#p179402"/>
<title type="html"><![CDATA[Support and Development • Re: &quot;Questions that don't deserve their own thread&quot; thread]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179402#p179402"><![CDATA[
<blockquote><div><cite>Bindie wrote:</cite><br />This is a great thread for my question.<br /><br />I tried making a love file, however it seems main.lua has a hard time reaching my assets folder even though I have archieved the insides of the main folder. I'll attach the tried .love and for the sake of an unconditional guide there's a zip.<br /><br />In this tutorial, is there some way of determining from player.x and player.y what tile one is on? I was thinking of using it for activating doors and such. I guess that will do. <br /><br />Thanks for any help.<br /><br />Bindie<br /></div></blockquote><br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>x, y = floor( player.x / TILEWIDTH ), floor( player.y / TILEHEIGHT )</code></dd></dl><br /><br />ofc account for map offset / camera stuff if present and messing with player/map position<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135654">S0lll0s</a> — Sun Jan 25, 2015 9:37 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[S0lll0s]]></name></author>
<updated>2015-01-25T21:36:21+00:00</updated>
<published>2015-01-25T21:36:21+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179401#p179401</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179401#p179401"/>
<title type="html"><![CDATA[Support and Development • Re: drawing with transparency]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179401#p179401"><![CDATA[
<blockquote><div><cite>DaedalusYoung wrote:</cite><br />The problem is indeed the transparency. When you scale the png, LÖVE interpolates all the colour channels, including alpha. So you get a blend of transparency, but the colour of the underlying pixels is black (so some pixel's colour value is 0,0,0,255). The solution lies in your image editor, make all transparent pixels have an underlying colour that is not black. How you do this, depends on what editor you use.<br /></div></blockquote><br />Or floor the image coordinates (at least that works usually... not exactly sure whether this isometric-tiled-stuff is a special case)<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135654">S0lll0s</a> — Sun Jan 25, 2015 9:36 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[DaedalusYoung]]></name></author>
<updated>2015-01-25T21:17:23+00:00</updated>
<published>2015-01-25T21:17:23+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179399#p179399</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179399#p179399"/>
<title type="html"><![CDATA[Support and Development • Re: drawing with transparency]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179399#p179399"><![CDATA[
The problem is indeed the transparency. When you scale the png, LÖVE interpolates all the colour channels, including alpha. So you get a blend of transparency, but the colour of the underlying pixels is black (so some pixel's colour value is 0,0,0,255). The solution lies in your image editor, make all transparent pixels have an underlying colour that is not black. How you do this, depends on what editor you use.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=126818">DaedalusYoung</a> — Sun Jan 25, 2015 9:17 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Bindie]]></name></author>
<updated>2015-01-25T21:06:47+00:00</updated>
<published>2015-01-25T21:06:47+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179397#p179397</id>
<link href="http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179397#p179397"/>
<title type="html"><![CDATA[Support and Development • Re: &quot;Questions that don't deserve their own thread&quot; thread]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=78401&amp;p=179397#p179397"><![CDATA[
This is a great thread for my question.<br /><br />I tried making a love file, however it seems main.lua has a hard time reaching my assets folder even though I have archieved the insides of the main folder. I'll attach the tried .love and for the sake of an unconditional guide there's a zip.<br /><br />In this tutorial, is there some way of determining from player.x and player.y what tile one is on? I was thinking of using it for activating doors and such. I guess that will do. <br /><br />Thanks for any help.<br /><br />Bindie<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136234">Bindie</a> — Sun Jan 25, 2015 9:06 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Drakkahn]]></name></author>
<updated>2015-01-25T20:32:37+00:00</updated>
<published>2015-01-25T20:32:37+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179396#p179396</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179396#p179396"/>
<title type="html"><![CDATA[Support and Development • Re: Window being held issue]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179396#p179396"><![CDATA[
This is what I now have, however it is not working. If you hold the window long enough all the enemies will end up with the same x and y values.<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>function love.update(dt)<br /><br />   dt=math.min(dt,1/30)<br /><br />   --run events<br /><br />end<br /></code></dd></dl><br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>self.x=self.x+100*dt</code></dd></dl><p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136202">Drakkahn</a> — Sun Jan 25, 2015 8:32 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Bindie]]></name></author>
<updated>2015-01-25T19:43:17+00:00</updated>
<published>2015-01-25T19:43:17+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179393#p179393</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179393#p179393"/>
<title type="html"><![CDATA[Support and Development • Re: Camera follow player and update world]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179393#p179393"><![CDATA[
Thanks, next upload will be with .loves.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136234">Bindie</a> — Sun Jan 25, 2015 7:43 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[davisdude]]></name></author>
<updated>2015-01-25T19:21:03+00:00</updated>
<published>2015-01-25T19:21:03+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179392#p179392</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179392#p179392"/>
<title type="html"><![CDATA[Support and Development • Re: [HELP] &lt;- PLEASE DON'T DO THIS]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179392#p179392"><![CDATA[
&quot;Having Some Trouble&quot;<br />^ Just about the worst title you can give a thread.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=115573">davisdude</a> — Sun Jan 25, 2015 7:21 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jasoco]]></name></author>
<updated>2015-01-25T18:24:03+00:00</updated>
<published>2015-01-25T18:24:03+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179391#p179391</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179391#p179391"/>
<title type="html"><![CDATA[Support and Development • Re: Tetris piece collision]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179391#p179391"><![CDATA[
Well, if you want to, you could see how Microsoft did it back in the QBasic days...<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>'===========================================================================<br />' Subject: QBLOCKS                           Date: Unknown Date (00:00:00)<br />' Author:  Microsoft Inc.                    Code: QB, QBasic             <br />' Keys:    QBLOCKS,TETRIS,MICROSOFT        Packet: GAMES.ABC<br />'===========================================================================<br />'                                QBLOCKS.BAS<br />'<br />' Press Page Down for information on running and modifying QBlocks.<br />'<br />' To run this game, press Shift+F5.<br />'<br />' To exit this program, press ALT, F, X.<br />'<br />' To get help on a BASIC keyword, move the cursor to the keyword and press<br />' F1 or click the right mouse button.<br />'<br />'                             Suggested Changes<br />'                             -----------------<br />'<br />' There are many ways that you can modify this BASIC game.  The CONST<br />' statements below these comments and the DATA statements at the end<br />' of this screen can be modified to change the following:<br />'<br />'    Block shapes<br />'    Block rotation<br />'    Number of different block shapes<br />'    Score needed to advance to next level<br />'    Width of the game well<br />'    Height of the game well<br />'    Songs played during game<br />'<br />' On the right side of each CONST statement, there is a comment that tells<br />' you what it does and how big or small you can set the value.  Above the<br />' DATA statements, there are comments that tell you the format of the<br />' information stored there.<br />'<br />' On your own, you can also add exciting sound and visual effects or make any<br />' other changes that your imagination can dream up.  By reading the<br />' Learn BASIC Now book, you'll learn the techniques that will enable you<br />' to fully customize this game and to create games of your own.<br />'<br />' If the game won't run after you have changed it, you can exit without<br />' saving your changes by pressing Alt, F, X and choosing NO.<br />'<br />' If you do want to save your changes, press Alt, F, A and enter a filename<br />' for saving your version of the program.  Before you save your changes,<br />' however, you should make sure they work by running the program and<br />' verifying that your changes produce the desired results.  Also, always<br />' be sure to keep a backup of the original program.<br />'<br />DEFINT A-Z\n' Here are the BASIC CONST statements you can change.  The comments tell<br />' you the range that each CONST value can be changed, or any limitations.<br />CONST WELLWIDTH = 10        ' Width of playing field (well).   Range 5 to 13.<br />CONST WELLHEIGHT = 21       ' Height of playing field.  Range 4 to 21.<br />CONST NUMSTYLES = 7         ' Number of unique shapes.  Range 1 to 20.  Make sure you read the notes above the DATA statements at the end of the main program before you change this number!<br />CONST WINGAME = 1000000     ' Points required to win the game.  Range 200 to 9000000.<br />CONST NEXTLEVEL = 300       ' Helps determine when the game advances to the next level.  (Each cleared level gives player 100 points) Range 100 to 2000.<br />CONST BASESCORE = 1000      ' Number of points needed to advance to first level.<br />CONST ROTATEDIR = 1         ' Control rotation of blocks. Can be 1 for clockwise, or 3 for counterclockwise.<br />' The following sound constants are used by the PLAY command to<br />' produce music during the game.  To change the sounds you hear, change<br />' these constants.  Refer to the online help for PLAY for the correct format.<br />' To completely remove sound from the game set the constants equal to null.<br />' For example:  PLAYINTRO = &quot;&quot;<br />CONST PLAYCLEARROW = &quot;MBT255L16O4CDEGO6C&quot;         ' Tune played when a row is cleared.  Range unlimited.<br />CONST PLAYINTRO = &quot;MBT170O1L8CO2CO1CDCA-A-FGFA-F&quot; ' Song played at game start.  Range unlimited.<br />CONST PLAYGAMEOVER = &quot;MBT255L16O6CO4GEDC&quot;         ' Song when the game is lost.  Range unlimited.<br />CONST PLAYNEWBLOCK = &quot;MBT160L28N20L24N5&quot;          ' Song when a new block is dropped.  Range unlimited.<br />CONST PLAYWINGAME = &quot;T255L16O6CO4GEDCCDEFGO6CEG&quot;  ' Song when game is won.  Range unlimited.\n' The following CONST statements should not be changed like the ones above<br />' because the program relies on them being this value.<br />CONST FALSE = 0             ' 0 means FALSE.<br />CONST TRUE = NOT FALSE      ' Anything but 0 can be thought of as TRUE.<br />CONST SPACEBAR = 32         ' ASCII value for space character. Drops the shape.<br />CONST DOWNARROW = 80        ' Down arrow key.  Drops the shape.<br />CONST RIGHTARROW = 77       ' Right arrow key.  Moves the shape right.<br />CONST UPARROW = 72          ' Up arrow key.  Rotates the shape.<br />CONST LEFTARROW = 75        ' Left arrow key.  Moves the shape left.<br />CONST DOWNARROW2 = 50       ' 2 key.  Drops the shape.<br />CONST RIGHTARROW2 = 54      ' 6 key.  Moves the shape right.<br />CONST UPARROW2 = 56         ' 8 key.  Rotates the shape.<br />CONST LEFTARROW2 = 52       ' 4 key.  Moves the shape left.<br />CONST UPARROW3 = 53         ' 5 key.  Rotates the shape.<br />CONST QUIT = &quot;Q&quot;            ' Q key.  Quits the game.<br />CONST PAUSE = &quot;P&quot;           ' P key.  Pauses the game.<br />CONST XMATRIX = 3           ' Width of the matrix that forms each falling unit.  See the discussions in Suggested Changes #2 and #3.<br />CONST YMATRIX = 1           ' Depth of the matrix that forms each falling unit.<br />CONST BYTESPERBLOCK = 76    ' Number of bytes required to store one block in Screen mode 7.<br />CONST BLOCKVOLUME = (XMATRIX + 1) * (YMATRIX + 1)   ' Number of blocks in each shape.<br />CONST ELEMENTSPERBLOCK = BLOCKVOLUME * BYTESPERBLOCK \ 2    ' Number of INTEGER array elements needed to store an image of a shape.<br />CONST XSIZE = 13            ' Width, in pixels, of each block.  QBlocks assumes that the entire screen is 25 blocks wide.  Since the screen is 320 pixels wide, each block is approximately 13 pixels wide.<br />CONST YSIZE = 8             ' Height, in pixels, of each block.  Again, QBlocks assumes that screen is 25 blocks high.  At 200 pixels down, each block is exactly 8 pixels high.<br />CONST XOFFSET = 10          ' X position, in blocks, of the well.<br />CONST YOFFSET = 2           ' Y position, in blocks, of the well.<br />CONST WELLX = XSIZE * XOFFSET   ' X position, in pixels, of the start of the well.<br />CONST WELLY = YSIZE * YOFFSET   ' Y position.<br />CONST TILTVALUE = 9999000   ' Points required for QBlocks to tilt.<br />CONST WELLCOLOR7 = 0        ' Well color for SCREEN 7.<br />CONST WELLCOLOR1 = 0        ' Well color for SCREEN 1.<br />CONST BORDERCOLOR1 = 8      ' Border color for SCREEN 1.<br />CONST BORDERCOLOR7 = 15     ' Border color for SCREEN 7.\nTYPE BlockType              ' Block datatype.<br />    X AS INTEGER            ' Horizontal location within the well.<br />    Y AS INTEGER            ' Vertical location within the well.<br />    Style AS INTEGER        ' Define shape (and color, indirectly).<br />    Rotation AS INTEGER     ' 4 possible values (0 to 3).<br />END TYPE\n' SUB and FUNCTION declarations<br />DECLARE FUNCTION CheckFit ()<br />DECLARE FUNCTION GameOver ()<br />DECLARE SUB AddBlockToWell ()<br />DECLARE SUB CheckForFullRows ()<br />DECLARE SUB Center (M$, Row)<br />DECLARE SUB DeleteChunk (Highest%, Lowest%)<br />DECLARE SUB DisplayIntro ()<br />DECLARE SUB DisplayGameTitle ()<br />DECLARE SUB DisplayChanges ()<br />DECLARE SUB DrawBlock (X, Y, FillColor)<br />DECLARE SUB InitScreen ()<br />DECLARE SUB MakeInfoBox ()<br />DECLARE SUB NewBlock ()<br />DECLARE SUB PerformGame ()<br />DECLARE SUB RedrawControls ()<br />DECLARE SUB Show (b AS BlockType)<br />DECLARE SUB UpdateScoring ()<br />DECLARE SUB PutBlock (b AS BlockType)<br />DECLARE SUB DrawAllShapes ()<br />DECLARE SUB DrawPattern (Patttern)<br />DECLARE SUB DrawPlayingField ()\n' DIM SHARED indicates that a variable is available to all subprograms.<br />' Without this statement, a variable used in one subprogram cannot be<br />' used by another subprogram or the main program.<br />DIM SHARED Level AS INTEGER                                         ' Difficulty level.  0 is slowest, 9 is fastest.<br />DIM SHARED WellBlocks(WELLWIDTH, WELLHEIGHT) AS INTEGER             ' 2 dimensional array to hold the falling shapes that have stopped falling and become part of the well.<br />DIM SHARED CurBlock AS BlockType                                    ' The falling shape.<br />DIM SHARED BlockShape(0 TO XMATRIX, 0 TO YMATRIX, 1 TO NUMSTYLES)   ' Holds the data required to make each shape.  Values determined by the DATA statements at the end of this window.<br />DIM SHARED PrevScore AS LONG                                        ' Holds the previous level for scoring purposes.<br />DIM SHARED Score AS LONG                                            ' Score.<br />DIM SHARED ScreenWidth AS INTEGER                                   ' Width of the screen, in character-sized units.<br />DIM SHARED ScreenMode AS INTEGER                                    ' Value of the graphics screen mode used.<br />DIM SHARED WellColor AS INTEGER                                     ' Color inside the well.<br />DIM SHARED BorderColor AS INTEGER                                   ' Color of well border and text.<br />DIM SHARED OldBlock AS BlockType                                    ' An image of the last CurBlock.  Used to erase falling units when they move.<br />DIM SHARED TargetTime AS SINGLE                                     ' Time to move the shape down again.<br />DIM SHARED GameTiltScore AS LONG                                    ' Holds the value that this game will tilt at.<br />DIM SHARED Temp(11175)  AS INTEGER                                  ' Used by several GET and PUT statements to store temporary screen images.<br />DIM SHARED BlockColor(1 TO NUMSTYLES) AS INTEGER                    ' Block color array<br />DIM SHARED BlockImage((NUMSTYLES * 4 + 3) * ELEMENTSPERBLOCK) AS INTEGER    ' Holds the binary image of each rotation of each shape for the PutBlock subprogram to use.<br />DIM KeyFlags AS INTEGER                                             ' Internal state of the keyboard flags when game starts.  Hold the state so it can be restored when the games ends.<br />DIM BadMode AS INTEGER                                              ' Store the status of a valid screen mode.ON ERROR GOTO ScreenError               ' Set up a place to jump to if an error occurs in the program.<br />BadMode = FALSE<br />ScreenMode = 7<br />SCREEN ScreenMode                       ' Attempt to go into SCREEN 7 (EGA screen).<br />IF BadMode = TRUE THEN                  ' If this attempt failed.<br />    ScreenMode = 1<br />    BadMode = FALSE<br />    SCREEN ScreenMode                   ' Attempt to go into SCREEN 1 (CGA screen).<br />END IF<br />ON ERROR GOTO 0                         ' Turn off error handling.\nIF BadMode = TRUE THEN                  ' If no graphics adapter.    CLS    LOCATE 10, 12: PRINT &quot;CGA, EGA Color, or VGA graphics required to run QBLOCKS.BAS&quot;ELSE    RANDOMIZE TIMER                     ' Create a new sequence of random numbers based on the clock.    DisplayIntro                        ' Show the opening screen.    DEF SEG = 0                         ' Set the current segment to the low memory area.<br />    KeyFlags = PEEK(1047)               ' Read the location that holds the keyboard flag.<br />    IF (KeyFlags AND 32) = 0 THEN       ' If the NUM LOCK key is off<br />        POKE 1047, KeyFlays OR 32       ' set the NUM LOCK key to on.<br />    END IF<br />    DEF SEG                             ' Restore the default segment.<br />    <br />    ' Read the pattern for each QBlocks shape.<br />    FOR i = 1 TO NUMSTYLES                  ' Loop for the each shape<br />        FOR j = 0 TO YMATRIX                ' and for the Y and X dimensions of<br />            FOR k = 0 TO XMATRIX            ' each shape.<br />                READ BlockShape(k, j, i)    ' Actually read the data.<br />            NEXT k<br />        NEXT j<br />    NEXT i<br />    DrawAllShapes                       ' Draw all shapes in all four rotations.<br />    PerformGame                         ' Play the game until the player quits.<br />    DisplayChanges                      ' Show the suggested changes.<br />   <br />    DEF SEG = 0                         ' Set the current segment back to low memory where the keyboard flags are.<br />    POKE 1047, KeyFlags AND 233         ' Set the NUM LOCK key back to where it was at the game start.<br />    DEF SEG                             ' Restore the current segment back to BASIC's data group area.    IF ScreenMode = 7 THEN PALETTE      ' Restore the default color palette if SCREEN 7 was used.END IFEND                                     ' End of the main program code.' The DATA statements below define the block shapes used in the game.<br />' Each shape contains 8 blocks (4 x 2).  A &quot;1&quot; means that there<br />' is a block in that space; &quot;0&quot; means that the block is blank.  The pattern<br />' for Style 1, for example, creates a shape that is 4 blocks wide.<br />' To change an existing block's shape, change a &quot;0&quot; to a &quot;1&quot; or a &quot;1&quot; to<br />' a &quot;0&quot;.  To add new shapes, insert new DATA statements with the same format<br />' as those below, after the last group of DATA statements (style 7).  Be sure<br />' to change the NUMSTYLES constant at the beginning of this program to reflect<br />' the new number of block shapes for the game.<br />' IMPORTANT! Creating a completely blank block will cause QBlocks to fail.\n' Data for Style 1: Long<br />DATA 1,1,1,1<br />DATA 0,0,0,0\n' Data for Style 2: L Right<br />DATA 1,1,1,0<br />DATA 0,0,1,0\n' Data for Style 3: L Left<br />DATA 0,1,1,1<br />DATA 0,1,0,0\n' Data for Style 4: Z Right<br />DATA 1,1,0,0<br />DATA 0,1,1,0\n' Data for Style 5: Z Left<br />DATA 0,1,1,0<br />DATA 1,1,0,0\n' Data for Style 6: T<br />DATA 1,1,1,0<br />DATA 0,1,0,0\n' Data for Style 7: Square<br />DATA 0,1,1,0<br />DATA 0,1,1,0ScreenError:                            ' QBlocks uses this error handler to determine the highest available video mode.<br />    BadMode = TRUE<br />    RESUME NEXT\n'----------------------------------------------------------------------------<br />' AddBlockToWell<br />'<br />'    After a shape stops falling, put it into the WellBlocks array<br />'    so later falling shapes know where to stop.<br />'<br />'           PARAMETERS:    None.<br />'----------------------------------------------------------------------------<br />SUB AddBlockToWell<br />   <br />    FOR i = 0 TO XMATRIX                                    ' Loop through all elements in the array.<br />        FOR j = 0 TO YMATRIX<br />            IF BlockShape(i, j, CurBlock.Style) = 1 THEN    ' If there is a block in that space.<br />                SELECT CASE CurBlock.Rotation               ' Use the Rotation to determine how the blocks should map into the WellBlocks array.<br />                    CASE 0              ' No rotation.<br />                        WellBlocks(CurBlock.X + i, CurBlock.Y + j) = CurBlock.Style<br />                    CASE 1              ' Rotated 90 degrees clockwise.<br />                        WellBlocks(CurBlock.X - j + 2, CurBlock.Y + i - 1) = CurBlock.Style<br />                    CASE 2              ' Rotated 180 degrees.<br />                        WellBlocks(CurBlock.X - i + 3, CurBlock.Y - j + 1) = CurBlock.Style<br />                    CASE 3               ' Rotated 270 degrees clockwise.<br />                        WellBlocks(CurBlock.X + j + 1, CurBlock.Y - i + 2) = CurBlock.Style<br />                END SELECT<br />            END IF<br />        NEXT j<br />    NEXT i<br />END SUB\n'----------------------------------------------------------------------------<br />' Center<br />'<br />'    Centers a string of text on a specified row.<br />'<br />'           PARAMETERS:    Text$ - Text to display on the screen.<br />'                          Row   - Row on the screen where the text$ is<br />'                                  displayed.<br />'----------------------------------------------------------------------------<br />SUB Center (text$, Row)\n  LOCATE Row, (ScreenWidth - LEN(text$)) \ 2 + 1<br />  PRINT text$;\nEND SUB\n'----------------------------------------------------------------------------<br />' CheckFit<br />'<br />'    Checks to see if the shape will fit into its new position.<br />'    Returns TRUE if it fits and FALSE if it does not fit.<br />'<br />'           PARAMETERS:    None<br />'<br />'----------------------------------------------------------------------------<br />FUNCTION CheckFit\n    CheckFit = TRUE                     ' Assume the shape will fit.<br />   <br />    FOR i = 0 TO XMATRIX                ' Loop through all the blocks in the<br />        FOR j = 0 TO YMATRIX            ' shape and see if any would<br />                                        ' overlap blocks already in the well.<br />            IF BlockShape(i, j, CurBlock.Style) = 1 THEN    ' 1 means that space, within the falling shape, is filled with a block.<br />                SELECT CASE CurBlock.Rotation               ' Base the check on the rotation of the shape.<br />                    CASE 0                         ' No rotation.<br />                        NewX = CurBlock.X + i<br />                        NewY = CurBlock.Y + j<br />                    CASE 1                         ' Rotated 90 degrees clockwise, or 270 degrees counterclockwise.<br />                        NewX = CurBlock.X - j + 2<br />                        NewY = CurBlock.Y + i - 1<br />                    CASE 2                         ' Rotated 180 degrees.<br />                        NewX = CurBlock.X - i + 3<br />                        NewY = CurBlock.Y - j + 1<br />                    CASE 3                         ' Rotated 270 degrees clockwise, or 90 degrees counterclockwise.<br />                        NewX = CurBlock.X + j + 1<br />                        NewY = CurBlock.Y - i + 2<br />                END SELECT\n                ' Set CheckFit to false if the block would be out of the well.<br />                IF (NewX &gt; WELLWIDTH - 1 OR NewX &lt; 0 OR NewY &gt; WELLHEIGHT - 1 OR NewY &lt; 0) THEN<br />                    CheckFit = FALSE<br />                    EXIT FUNCTION\n                ' Otherwise, set CheckFit to false if the block overlaps<br />                ' an existing block.<br />                ELSEIF WellBlocks(NewX, NewY) THEN<br />                    CheckFit = FALSE<br />                    EXIT FUNCTION<br />                END IF\n            END IF<br />        NEXT j<br />    NEXT i\nEND FUNCTION\n'----------------------------------------------------------------------------<br />' CheckForFullRows<br />'<br />'    Checks for filled rows.  If a row is filled, delete it and move<br />'    the blocks above down to fill the deleted row.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB CheckForFullRows\n    DIM RowsToDelete(WELLHEIGHT)    ' Temporary array to track rows that should be deleted.<br />    NumRowsToDelete = 0<br />    i = WELLHEIGHT                  ' Begin scanning from the bottom up.<br />    DO<br />        DeleteRow = TRUE            ' Assume the row should be deleted.<br />        j = 0<br />        DO                          ' Scan within each row for blocks.<br />            DeleteRow = DeleteRow * SGN(WellBlocks(j, i)) ' If any position is blank, DeleteRow is 0 (FALSE).<br />            j = j + 1<br />        LOOP WHILE DeleteRow = TRUE AND j &lt; WELLWIDTH<br />       <br />        IF DeleteRow = TRUE THEN<br />            ' Walk up the rows and copy them down in the WellBlocks array.<br />            NumRowsToDelete = NumRowsToDelete + 1   ' Number of rows to delete.<br />            RowsToDelete(i - NumDeleted) = TRUE     ' Mark the rows to be deleted, compensating for rows that have already been deleted below it.<br />            NumDeleted = NumDeleted + 1             ' Compensates for rows that have been deleted already.<br />           <br />            ' Logically delete the row by moving all WellBlocks values down.<br />            FOR Row = i TO 1 STEP -1<br />                FOR Col = 0 TO WELLWIDTH<br />                    WellBlocks(Col, Row) = WellBlocks(Col, Row - 1)<br />                NEXT Col<br />            NEXT Row<br />        ELSE                        ' This row will not be deleted.<br />            i = i - 1<br />        END IF<br />    LOOP WHILE i &gt;= 1                ' Stop looping when the top of the well is reached.<br />           <br />    IF NumRowsToDelete &gt; 0 THEN<br />        Score = Score + 100 * NumRowsToDelete  ' Give 100 points for every row.<br />       <br />        ' Set Highest and Lowest such that any deleted row will initially set them.<br />        Highest = -1<br />        Lowest = 100<br />       <br />        ' Find where the highest and lowest rows to delete are.<br />        FOR i = WELLHEIGHT TO 1 STEP -1<br />            IF RowsToDelete(i) = TRUE THEN<br />                IF i &gt; Highest THEN Highest = i<br />                IF i &lt; Lowest THEN Lowest = i<br />            END IF<br />        NEXT i<br />        <br />        IF (Highest - Lowest) + 1 = NumRowsToDelete THEN    ' Only one contiguous group of rows to delete.<br />            DeleteChunk Highest, Lowest<br />        ELSE                                                ' Two groups of rows to delete.<br />            ' Begin at Lowest and scan down for a row NOT to be deleted.<br />            ' Then delete everything from Lowest to the row not to be deleted.<br />            i = Lowest<br />            DO WHILE i &lt;= Highest<br />                IF RowsToDelete(i) = FALSE THEN<br />                    DeleteChunk i - 1, Lowest<br />                    EXIT DO<br />                ELSE<br />                    i = i + 1<br />                END IF<br />            LOOP<br />           <br />            ' Now look for the second group and delete those rows.<br />            Lowest = i<br />            DO WHILE RowsToDelete(Lowest) = FALSE<br />                Lowest = Lowest + 1<br />            LOOP<br />            DeleteChunk Highest, Lowest<br />       <br />        END IF<br />    END IF\nEND SUB\n'----------------------------------------------------------------------------<br />' DeleteChunk<br />'<br />'    Deletes a group of one or more rows.<br />'<br />'           PARAMETERS:    Highest - Highest row to delete (physically lowest<br />'                                    on screen).<br />'                          Lowest  - Lowest row to delete (physically highest<br />'                                    on screen).<br />'----------------------------------------------------------------------------<br />SUB DeleteChunk (Highest, Lowest)<br />   <br />    ' GET the image of the row to delete.                              <br />    GET (WELLX, Lowest * YSIZE + WELLY)-(WELLX + WELLWIDTH * XSIZE, (Highest + 1) * YSIZE + WELLY - 1), Temp<br />    PLAY PLAYCLEARROW<br />   <br />    ' Flash the rows 3 times.<br />    FOR Flash = 1 TO 3<br />        PUT (WELLX, Lowest * YSIZE + WELLY), Temp, PRESET<br />        DelayTime! = TIMER + .02<br />        DO WHILE TIMER &lt; DelayTime!: LOOP<br />        PUT (WELLX, Lowest * YSIZE + WELLY), Temp, PSET<br />        DelayTime! = TIMER + .02<br />        DO WHILE TIMER &lt; DelayTime!: LOOP<br />    NEXT Flash<br />   <br />    ' Move all the rows above the deleted ones down.<br />    GET (WELLX, WELLY)-(WELLX + WELLWIDTH * XSIZE, Lowest * YSIZE + WELLY), Temp<br />    PUT (WELLX, (Highest - Lowest + 1) * YSIZE + WELLY), Temp, PSET<br />    'Erase the area above the block which just moved down.<br />    LINE (WELLX, WELLY)-(WELLX + WELLWIDTH * XSIZE, WELLY + (Highest - Lowest + 1) * YSIZE), WellColor, BF<br />END SUB\n'----------------------------------------------------------------------------<br />' DisplayChanges<br />'<br />'    Displays list of changes that the player can easily make.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB DisplayChanges\n    DisplayGameTitle                            ' Print game title.<br />    <br />    COLOR 7<br />    Center &quot;The following game characteristics can be easily changed from&quot;, 5<br />    Center &quot;within the QuickBASIC Interpreter.  To change the values of  &quot;, 6<br />    Center &quot;these characteristics, locate the corresponding CONST or DATA&quot;, 7<br />    Center &quot;statements in the source code and change their values, then  &quot;, 8<br />    Center &quot;restart the program (press Shift + F5).                      &quot;, 9\n    COLOR 15<br />    Center &quot;Block shapes                         &quot;, 11<br />    Center &quot;Block rotation                       &quot;, 12<br />    Center &quot;Number of different block shapes     &quot;, 13<br />    Center &quot;Score needed to advance to next level&quot;, 14<br />    Center &quot;Width of the game well               &quot;, 15<br />    Center &quot;Height of the game well              &quot;, 16<br />    Center &quot;Songs played during game             &quot;, 17\n    COLOR 7<br />    Center &quot;The CONST statements and instructions on changing them are   &quot;, 19<br />    Center &quot;located at the beginning of the main program.                &quot;, 20\n    DO WHILE INKEY$ = &quot;&quot;: LOOP                  ' Wait for any key to be pressed.<br />    CLS                                         ' Clear screen.\nEND SUB\n'----------------------------------------------------------------------------<br />' DisplayGameTitle<br />'<br />'    Displays title of the game.<br />'<br />'           PARAMETERS:    None.<br />'----------------------------------------------------------------------------<br />SUB DisplayGameTitle\n    SCREEN 0<br />    WIDTH 80, 25                                  ' Set width to 80, height to 25.<br />    COLOR 4, 0                                    ' Set colors for red on black.<br />    CLS                                           ' Clear the screen.<br />    ScreenWidth = 80                              ' Set screen width variable to match current width.\n    ' Draw outline around screen with extended ASCII characters.<br />    LOCATE 1, 2<br />    PRINT CHR$(201); STRING$(76, 205); CHR$(187);<br />    FOR i% = 2 TO 24<br />        LOCATE i%, 2<br />        PRINT CHR$(186); TAB(79); CHR$(186);<br />    NEXT i%<br />    LOCATE 25, 2<br />    PRINT CHR$(200); STRING$(76, 205); CHR$(188);\n    'Print game title centered at top of screen<br />    COLOR 0, 4<br />    Center &quot;      Microsoft      &quot;, 1<br />    Center &quot;    Q B L O C K S    &quot;, 2<br />    Center &quot;   Press any key to continue   &quot;, 25  ' Center prompt on line 25.<br />    COLOR 7, 0\nEND SUB\n'----------------------------------------------------------------------------<br />' DisplayIntro<br />'<br />'    Explains the object of the game and how to play.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB DisplayIntro<br />    <br />    CLS<br />    DisplayGameTitle<br />   <br />    Center &quot;QBlocks challenges you to keep the well from filling.  Do this by&quot;, 5<br />    Center &quot;completely filling rows with blocks, making the rows disappear.  &quot;, 6<br />    Center &quot;Move and rotate the falling shapes to get them into the best     &quot;, 7<br />    Center &quot;position.  The game will get faster as you score more points.    &quot;, 8\n    COLOR 4                                 ' Change foreground color for line to red.<br />    Center STRING$(74, 196), 11             ' Put horizontal red line on screen.<br />    COLOR 7     ' White (7) letters.        ' Change foreground color back to white<br />    Center &quot; Game Controls &quot;, 11            ' Display game controls.<br />    Center &quot;     General                             Block Control      &quot;, 13<br />    Center &quot;                                     (Rotate)&quot;, 15<br />    Center &quot;   P - Pause                                 &quot; + CHR$(24) + &quot; (or 5)   &quot;, 16<br />    Center &quot;      Q - Quit                         (Left) &quot; + CHR$(27) + &quot;   &quot; + CHR$(26) + &quot; (Right)   &quot;, 17<br />    Center &quot;                                    &quot; + CHR$(25), 18<br />    Center &quot;                                          (Drop)      &quot;, 19<br />    <br />    DO                                      ' Wait for any key to be pressed.<br />        kbd$ = UCASE$(INKEY$)<br />    LOOP WHILE kbd$ = &quot;&quot;<br />    IF kbd$ = &quot;Q&quot; THEN                      'Allow player to quit now<br />        CLS<br />        LOCATE 10, 30: PRINT &quot;Really quit? (Y/N)&quot;;<br />        DO<br />            kbd$ = UCASE$(INKEY$)<br />        LOOP WHILE kbd$ = &quot;&quot;<br />        IF kbd$ = &quot;Y&quot; THEN<br />            CLS<br />            END<br />        END IF<br />    END IF\nEND SUB\n'----------------------------------------------------------------------------<br />' DrawAllShapes<br />'<br />'    Quickly draws all shapes in all four rotations.  Uses GET<br />'    to store the images so they can be PUT onto the screen<br />'    later very quickly.<br />'<br />'           PARAMETERS:    None.<br />'----------------------------------------------------------------------------<br />SUB DrawAllShapes\n    DIM b AS BlockType<br />    SCREEN ScreenMode                   ' Set the appropriate screen mode.<br />   <br />    ' On EGA and VGA systems, appear to blank the screen.<br />    IF ScreenMode = 7 THEN<br />        DIM Colors(0 TO 15)             ' DIM an array of 16 elements.  By default, all elements are 0.<br />        PALETTE USING Colors            ' Redefine the colors all to 0.<br />        FOR i = 1 TO NUMSTYLES          ' Set block colors EGA, VGA<br />            BlockColor(i) = ((i - 1) MOD 7) + 1<br />        NEXT i<br />    ELSE<br />        FOR i = 1 TO NUMSTYLES          'Set block colors for CGA<br />            BlockColor(i) = ((i - 1) MOD 3) + 1<br />        NEXT i<br />    END IF\n    CLS<br />    Count = 0                           ' Count determines how many shapes have been drawn on the screen and vertically where.<br />    FOR shape = 1 TO NUMSTYLES          ' Loop through all shapes.\n        RtSide = 4<br />        DO<br />            IF BlockShape(RtSide - 1, 0, shape) = 1 OR BlockShape(RtSide - 1, 1, shape) = 1 THEN EXIT DO<br />            RtSide = RtSide - 1<br />        LOOP UNTIL RtSide = 1\n        LtSide = 0<br />        DO<br />            IF BlockShape(LtSide, 0, shape) = 1 OR BlockShape(LtSide, 1, shape) = 1 THEN EXIT DO<br />            LtSide = LtSide + 1<br />        LOOP UNTIL LtSide = 3\n        FOR Rotation = 0 TO 3           ' Loop through all rotations.<br />            b.X = Rotation * 4 + 2      ' Determine where to put the shape.<br />            b.Y = Count + 2<br />            b.Rotation = Rotation<br />            b.Style = shape<br />            Show b                      ' Draw the shape.<br />           <br />            X = b.X: Y = b.Y<br />            SELECT CASE Rotation        ' Based on Rotation, determine where the shape really is on the screen.<br />                CASE 0                  ' No rotation.<br />                    x1 = X: x2 = X + RtSide: y1 = Y: y2 = Y + 2<br />                CASE 1                  ' Rotated 90 degrees clockwise.<br />                    x1 = X + 1: x2 = X + 3: y1 = Y - 1: y2 = Y + RtSide - 1<br />                CASE 2                  ' 180 degrees.<br />                    x1 = X: x2 = X + 4 - LtSide: y1 = Y: y2 = Y + 2<br />                CASE 3                  ' Rotated 270 degrees clockwise.<br />                    x1 = X + 1: x2 = X + 3: y1 = Y - 1: y2 = Y + 3 - LtSide<br />            END SELECT<br />           <br />            ' Store the image of the rotated shape into an array for fast recall later.<br />            GET (x1 * XSIZE, y1 * YSIZE)-(x2 * XSIZE, y2 * YSIZE), BlockImage(((shape - 1) * 4 + Rotation) * ELEMENTSPERBLOCK)<br />       <br />        NEXT Rotation<br />       <br />        Count = Count + 5               ' Increase Count by 5 to leave at least one blank line between shapes.<br />        IF Count = 20 THEN              ' No space for any more shapes.<br />            CLS<br />            Count = 0<br />        END IF<br />   <br />    NEXT shape<br />   <br />    CLS<br />   <br />    ' Changes the color palette if SCREEN is used.<br />    IF ScreenMode = 7 THEN<br />        PALETTE                         ' Restore default color settings.<br />        PALETTE 6, 14                   ' Make brown (6) look like yellow (14).<br />        PALETTE 14, 15                  ' Make yellow (14) look like bright white (15).<br />    END IF\nEND SUB\n'----------------------------------------------------------------------------<br />' DrawBlock<br />'<br />'    Draws one block of a QBlocks shape.<br />'<br />'           PARAMETERS:    X         - Horizontal screen location.<br />'                          Y         - Vertical screen location.<br />'                          FillColor - The primary color of the block.<br />'                                      The top and left edges will be the<br />'                                      brighter shade of that color.<br />'----------------------------------------------------------------------------<br />SUB DrawBlock (X, Y, FillColor)\n    LINE (X * XSIZE + 2, Y * YSIZE + 2)-((X + 1) * XSIZE - 2, (Y + 1) * YSIZE - 2), FillColor, BF<br />    LINE (X * XSIZE + 1, Y * YSIZE + 1)-((X + 1) * XSIZE - 1, Y * YSIZE + 1), FillColor + 8<br />    LINE (X * XSIZE + 1, Y * YSIZE + 1)-(X * XSIZE + 1, (Y + 1) * YSIZE - 1), FillColor + 8\nEND SUB\n'----------------------------------------------------------------------------<br />' DrawPattern<br />'<br />'    Draws a background pattern that is 32 pixels wide by 20 pixels<br />'    deep.  Gets the pattern and duplicates it to fill the screen.<br />'<br />'           PARAMETERS:    Pattern - Which of the 10 available patterns to<br />'                                    draw.<br />'----------------------------------------------------------------------------<br />SUB DrawPattern (Pattern)\n    CLS<br />    X = 1: Y = 1<br />    DIM Temp2(215) AS INTEGER           ' Create an array to store the image.<br />   <br />    ' Draw the pattern specified.<br />    SELECT CASE Pattern<br />    CASE 0<br />        j = Y + 21<br />        FOR i = X TO X + 27 STEP 3<br />            j = j - 2<br />            LINE (i, j)-(i, Y + 19), 12, BF<br />        NEXT i<br />        LINE (X, Y)-(X + 30, Y + 19), 4, B<br />        LINE (X + 1, Y + 1)-(X + 31, Y + 18), 4, B<br />    CASE 1<br />        LINE (X, Y)-(X + 8, Y + 12), 1, BF<br />        LINE (X + 9, Y + 8)-(X + 24, Y + 20), 2, BF<br />        LINE (X + 25, Y)-(X + 32, Y + 12), 3, BF<br />    CASE 2<br />        LINE (X, Y)-(X + 29, Y + 18), X / 32 + 1, B<br />        LINE (X + 1, Y + 1)-(X + 28, Y + 17), X / 32 + 2, B<br />    CASE 3<br />        FOR i = 0 TO 9 STEP 2<br />            LINE (X + i, Y + i)-(X + 29 - i, Y + 18 - i), i, B<br />        NEXT i<br />    CASE 4<br />        j = 0<br />        FOR i = 1 TO 30 STEP 3<br />            LINE (X + i, Y + j)-(X + 30 - i, Y + j), i<br />            LINE (X + i, Y + 19 - j)-(X + 30 - i, Y + 19 - j), i<br />            j = j + 2<br />        NEXT i<br />    CASE 5<br />        LINE (X, Y)-(X + 29, Y + 4), 1, BF<br />        LINE (X, Y)-(X + 4, Y + 18), 1, BF<br />        LINE (X + 7, Y + 7)-(X + 29, Y + 11), 5, BF<br />        LINE (X + 7, Y + 7)-(X + 11, Y + 18), 5, BF<br />        LINE (X + 14, Y + 14)-(X + 29, Y + 18), 4, BF<br />    CASE 6<br />        LINE (X + 15, Y)-(X + 17, Y + 19), 1<br />        LINE (X, Y + 9)-(X + 31, Y + 11), 2<br />        LINE (X, Y + 1)-(X + 31, Y + 18), 9<br />        LINE (X + 30, Y)-(X + 1, Y + 19), 10<br />    CASE 7<br />        FOR i = 1 TO 6<br />            CIRCLE (X + 16, Y + 10), i, i<br />        NEXT i<br />    CASE 8<br />        FOR i = X TO X + 30 STEP 10<br />            CIRCLE (i, Y + 9), 10, Y / 20 + 1<br />        NEXT i<br />    CASE 9<br />        LINE (X + 1, Y)-(X + 1, Y + 18), 3<br />        LINE (X + 1, Y)-(X + 12, Y + 18), 3<br />        LINE (X + 1, Y + 18)-(X + 12, Y + 18), 3<br />        LINE (X + 30, Y)-(X + 30, Y + 18), 3<br />        LINE (X + 30, Y)-(X + 19, Y + 18), 3<br />        LINE (X + 30, Y + 18)-(X + 19, Y + 18), 3<br />        LINE (X + 4, Y)-(X + 26, Y), 1<br />        LINE (X + 4, Y)-(X + 15, Y + 18), 1<br />        LINE (X + 26, Y)-(X + 15, Y + 18), 1<br />    END SELECT<br />   <br />    GET (0, 0)-(31, 19), Temp2  ' GET the image.<br />   <br />    ' Duplicate the image 10 times across by 10 times down.<br />    FOR H = 0 TO 319 STEP 32<br />        FOR V = 0 TO 199 STEP 20<br />            PUT (H, V), Temp2, PSET<br />        NEXT V<br />    NEXT H\nEND SUB\n'----------------------------------------------------------------------------<br />' DrawPlayingField<br />'<br />'    Draws the playing field, including the well, the title, the<br />'    score/level box, etc.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB DrawPlayingField<br />   <br />    SELECT CASE ScreenMode               ' Choose the screen colors based on the current mode.<br />        CASE 7<br />            WellColor = WELLCOLOR7<br />            BorderColor = BORDERCOLOR7\n        CASE ELSE                         ' Setup for SCREEN 1.<br />            WellColor = WELLCOLOR1<br />            BorderColor = BORDERCOLOR1<br />    END SELECT<br />   <br />    ScreenWidth = 40                      ' Set to proper width and colors.<br />   <br />    ' Draw the background pattern.<br />    DrawPattern Level<br />  <br />    ' Draw the well box.<br />    LINE (WELLX - 1, WELLY - 5)-(WELLX + WELLWIDTH * XSIZE + 1, WELLY + WELLHEIGHT * YSIZE + 1), WellColor, BF<br />    LINE (WELLX - 1, WELLY - 5)-(WELLX + WELLWIDTH * XSIZE + 1, WELLY + WELLHEIGHT * YSIZE + 1), BorderColor, B<br />   <br />    ' Draw the title box.<br />    LINE (XSIZE, WELLY - 5)-(XSIZE * 8, WELLY + 12), WellColor, BF<br />    LINE (XSIZE, WELLY - 5)-(XSIZE * 8, WELLY + 12), BorderColor, B<br />   <br />    ' Draw the scoring box.<br />    LINE (XSIZE, WELLY + 20)-(WELLX - 2 * XSIZE, 78), WellColor, BF<br />    LINE (XSIZE, WELLY + 20)-(WELLX - 2 * XSIZE, 78), BorderColor, B<br />                                         <br />    MakeInfoBox                     ' Draw the Information Box.\n    COLOR 12<br />    LOCATE 3, 5: PRINT &quot;QBLOCKS&quot;     ' Center the program name on line 2.<br />    COLOR BorderColor\n    ' Draw the scoring area.<br />    LOCATE 6, 4: PRINT &quot;Score:&quot;;<br />    LOCATE 7, 4: PRINT USING &quot;#,###,###&quot;; Score<br />    LOCATE 9, 4: PRINT USING &quot;Level: ##&quot;; Level\nEND SUB\n'----------------------------------------------------------------------------<br />' GameOver<br />'<br />'    Ends the game and asks the player if he/she wants to play<br />'    again.  GameOver returns TRUE if the player wishes to stop<br />'    or FALSE if the player wants another game.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />FUNCTION GameOver<br />   <br />    PLAY PLAYGAMEOVER                           ' Play the game over tune.<br />    MakeInfoBox\n    DO WHILE INKEY$ &lt;&gt; &quot;&quot;: LOOP                 ' Clear the keyboard buffer.\n    ' Put Game Over messages into the InfoBox.<br />    LOCATE 14, 4: PRINT &quot;Game Over&quot;<br />    LOCATE 17, 6: PRINT &quot;Play&quot;<br />    LOCATE 18, 5: PRINT &quot;again?&quot;<br />    LOCATE 20, 6: PRINT &quot;(Y/N)&quot;<br />    <br />    ' Wait for the player to press either Y or N.<br />    DO<br />        a$ = UCASE$(INKEY$)                     ' UCASE$ assures that the key will be uppercase.  This eliminates the need to check for y and n in addition to Y and N.<br />    LOOP UNTIL a$ = &quot;Y&quot; OR a$ = &quot;N&quot;<br />   <br />    IF a$ = &quot;Y&quot; THEN                            ' If player selects &quot;Y&quot;,<br />        GameOver = FALSE                        ' game is not over,<br />    ELSE                                        ' otherwise<br />        GameOver = TRUE                         ' the game is over.<br />    END IF<br />  <br />END FUNCTION\n'----------------------------------------------------------------------------<br />' InitScreen<br />'<br />'    Draws the playing field and ask for the desired starting level.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB InitScreen\n    DrawPlayingField                ' Draw playing field assuming Level 0.\n    ' Prompt for starting level.<br />    COLOR 12                        ' Change foreground color to bright red.<br />    LOCATE 14, 5: PRINT &quot;Select&quot;;<br />    LOCATE 16, 5: PRINT &quot;start&quot;;<br />    LOCATE 18, 5: PRINT &quot;level?&quot;;<br />    LOCATE 20, 5: PRINT &quot;(0 - 9)&quot;;<br />    COLOR BorderColor               ' Restore the default text color to BorderColor (white).<br />    Level = TRUE                    ' Use level as flag as well as a real value.  Level remain TRUE if Q (Quit) is pressed instead of a level.<br />   <br />    ' Get a value for Level or accept a Q.<br />    DO<br />        a$ = UCASE$(INKEY$)<br />    LOOP WHILE (a$ &gt; &quot;9&quot; OR a$ &lt; &quot;0&quot;) AND a$ &lt;&gt; &quot;Q&quot;<br />   <br />    IF a$ = &quot;Q&quot; THEN<br />        EXIT SUB<br />    ELSE<br />        Level = VAL(a$)<br />    END IF\n    IF Level &gt; 0 THEN DrawPlayingField    ' Draw new playing field because the background pattern depends on the level.<br />    RedrawControls      ' Draw the controls.\nEND SUB\n'----------------------------------------------------------------------------<br />' MakeInfoBox<br />'<br />'    Draws the information box.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB MakeInfoBox\n    LINE (WELLX - 9 * XSIZE, 90)-(WELLX - 2 * XSIZE, 185), WellColor, BF    ' Clear the Info area.<br />    LINE (WELLX - 9 * XSIZE, 90)-(WELLX - 2 * XSIZE, 185), BorderColor, B   ' Draw a border around it.\nEND SUB\n'----------------------------------------------------------------------------<br />' NewBlock<br />'<br />'    Initializes a new falling shape about to enter the well.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB NewBlock\n    CurBlock.Style = INT(RND(1) * NUMSTYLES) + 1    ' Randomly pick a block style.<br />    CurBlock.X = (WELLWIDTH \ 2) - 1                ' Put the new shape in the horizontal middle of the well<br />    CurBlock.Y = 0                                  ' and at the top of the well.<br />    CurBlock.Rotation = 0                           ' Begin with no rotation.\n    PLAY PLAYNEWBLOCK\nEND SUB\n'----------------------------------------------------------------------------<br />' PerformGame<br />'<br />'    Continues to play the game until the player quits.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB PerformGame\n    DO                                          ' Loop for repetitive games<br />        a$ = &quot;&quot;<br />        ERASE WellBlocks                        ' Set all the elements in the WellBlocks array to 0.<br />        Score = 0                               ' Clear initial score.<br />        Level = 0                               ' Assume Level 0.<br />        PrevScore = BASESCORE - NEXTLEVEL       ' Set score needed to get to first level<br />        GameTiltScore = WINGAME                 ' Set the initial win game value.<br />       <br />        InitScreen                              ' Prepare the screen and get the difficulty level.<br />        IF Level = -1 THEN EXIT SUB             ' Player pressed Q instead of a level.<br />       <br />        TargetTime = TIMER + 1 / (Level + 1)    ' TargetTime is when the falling shape will move down again.<br />        DO                                      ' Create new falling shapes until the game is over.<br />            DoneWithThisBlock = FALSE           ' This falling shape is not done falling yet.<br />            NewBlock                            ' Create a new falling unit.<br />            IF CheckFit = FALSE THEN EXIT DO    ' If it does not fit, then the game is over.<br />            PutBlock CurBlock                   ' Display the new shape.<br />           <br />            DO                                  ' Continue dropping the falling shape.<br />                OldBlock = CurBlock             ' Save current falling shape for possible later use.<br />                DO                              ' Loop until enough time elapses.<br />                   <br />                    ValidEvent = TRUE           ' Assume a key was pressed.<br />                    ans$ = UCASE$(INKEY$)\n                    IF ans$ = PAUSE OR ans$ = QUIT THEN<br />                        MakeInfoBox<br />                   <br />                        ' SELECT CASE will do different actions based on the<br />                        ' value of the SELECTED variable.<br />                        SELECT CASE ans$<br />                            CASE PAUSE<br />                                SOUND 1100, .75<br />                                LOCATE 16, 6: PRINT &quot;GAME&quot;;<br />                                LOCATE 18, 5: PRINT &quot;PAUSED&quot;;<br />                                DO WHILE INKEY$ = &quot;&quot;: LOOP  ' Wait until another key is pressed.<br />                            CASE QUIT<br />                                ' Play sounds to tell the player that Q was pressed.<br />                                SOUND 1600, 1<br />                                SOUND 1000, .75<br />                               <br />                                ' Confirm that the player really wants to quit.<br />                                LOCATE 15, 5: PRINT &quot;Really&quot;;<br />                                LOCATE 17, 6: PRINT &quot;quit?&quot;;<br />                                LOCATE 19, 6: PRINT &quot;(Y/N)&quot;;<br />                                DO<br />                                    a$ = UCASE$(INKEY$)<br />                                LOOP UNTIL a$ &lt;&gt; &quot;&quot;<br />                                IF a$ = &quot;Y&quot; THEN EXIT SUB<br />                        END SELECT<br />                        RedrawControls  ' Redraw controls if either Q or P is pressed.<br />                   <br />                    ELSE    ' A key was pressed but not Q or P.<br />                        ans = ASC(RIGHT$(CHR$(0) + ans$, 1))    ' Convert the key press to an ASCII code for faster processing.<br />                        SELECT CASE ans<br />                        CASE DOWNARROW, DOWNARROW2, SPACEBAR    ' Drop shape immediately.<br />                            DO                                  ' Loop to drop the falling unit one row at a time.<br />                                CurBlock.Y = CurBlock.Y + 1<br />                            LOOP WHILE CheckFit = TRUE          ' Keep looping while the falling unit isn't stopped.<br />                            CurBlock.Y = CurBlock.Y - 1         ' Went one down too far, restore to previous.<br />                            TargetTime = TIMER - 1              ' Ensure that the shape falls immediately.<br />                        CASE RIGHTARROW, RIGHTARROW2<br />                            CurBlock.X = CurBlock.X + 1         ' Move falling unit right.<br />                        CASE LEFTARROW, LEFTARROW2<br />                            CurBlock.X = CurBlock.X - 1         ' Move falling unit left.<br />                        CASE UPARROW, UPARROW2, UPARROW3<br />                            CurBlock.Rotation = ((CurBlock.Rotation + ROTATEDIR) MOD 4)  ' Rotate falling unit.<br />                        CASE ELSE<br />                            ValidEvent = FALSE<br />                    END SELECT\n                    IF ValidEvent = TRUE THEN<br />                        IF CheckFit = TRUE THEN         ' If the move is valid and the shape fits in the new position,<br />                            PutBlock OldBlock           ' erase the shape from its old position<br />                            PutBlock CurBlock           ' and display it in the new position.<br />                            OldBlock = CurBlock<br />                        ELSE<br />                            CurBlock = OldBlock         ' If it does not fit then reset CurBlock to the OldBlock.<br />                        END IF<br />                    END IF<br />                END IF\n                LOOP UNTIL TIMER &gt;= TargetTime       ' Keep repeating the loop until it is time to drop the shape.  This allows many horizontal movements and rotations per vertical step.<br />               <br />                TargetTime = TIMER + 1 / (Level + 1) ' The player has less time between vertical movements as the skill level increases.<br />                CurBlock.Y = CurBlock.Y + 1          ' Try to drop the falling unit one row.\n                IF CheckFit = FALSE THEN             ' Cannot fall any more.<br />                    DoneWithThisBlock = TRUE         ' Done with this block.<br />                    CurBlock = OldBlock<br />                END IF<br />               <br />                PutBlock OldBlock                    ' Erase the falling shape from the old position,<br />                PutBlock CurBlock                    ' and display it in the new position.<br />                OldBlock = CurBlock\n            LOOP UNTIL DoneWithThisBlock             ' Continue getting keys and moving shapes until the falling shape stops.<br />           <br />            AddBlockToWell                           ' Shape has stopped so logically add it to the well.<br />            CheckForFullRows                         ' Check to see if a row(s) is now full.  If so, deletes it.<br />            UpdateScoring                            ' Use the UpdateScoring subprogram to add to the score.\n            IF Score &gt;= GameTiltScore THEN           ' See if the score has hit the tilt score.\n                PLAY PLAYWINGAME<br />                MakeInfoBox<br />                LOCATE 13, 5: PRINT USING &quot;#######&quot;; Score<br />                PLAY PLAYWINGAME\n                IF GameTiltScore = TILTVALUE THEN    ' If the player has tilted the game.<br />                    LOCATE 15, 4: PRINT &quot;GAME TILT&quot;<br />                    LOCATE 17, 5: PRINT &quot;You are&quot;<br />                    LOCATE 18, 4: PRINT &quot;Awesome!&quot;<br />                    LOCATE 20, 4: PRINT &quot;Press any&quot;<br />                    LOCATE 21, 6: PRINT &quot;key...&quot;<br />                    PLAY PLAYWINGAME<br />                    DO WHILE INKEY$ = &quot;&quot;: LOOP<br />                    EXIT SUB<br />                ELSE                                 ' If they just met the WINGAME value.<br />                    LOCATE 15, 4: PRINT &quot;YOU WON!&quot;<br />                    LOCATE 17, 5: PRINT &quot;Want to&quot;<br />                    LOCATE 18, 4: PRINT &quot;continue&quot;<br />                    LOCATE 20, 6: PRINT &quot;(Y/N)&quot;\n                    DO                               ' DO loop to wait for the player to press anything.<br />                        a$ = UCASE$(INKEY$)          ' The UCASE$ function assures that a$ always has an uppercase letter in it.<br />                    LOOP UNTIL a$ &lt;&gt; &quot;&quot;<br />        <br />                    IF a$ &lt;&gt; &quot;Y&quot; THEN EXIT DO        ' Exit this main loop if the player pressed anything but Y.\n                    GameTiltScore = TILTVALUE        ' Reset to the tilt value.\n                    RedrawControls<br />                END IF<br />            END IF\n        LOOP                                         ' Unconditional loop.  Each game is stopped by the EXIT DO command at the top of this loop that executes when a new block will not fit in the well.<br />    LOOP UNTIL GameOver                              ' GameOver is always TRUE (-1) unless the user presses X or the well is full.\nEND SUB\n'----------------------------------------------------------------------------<br />' PutBlock<br />'<br />'    Uses very fast graphics PUT command to draw the shape.<br />'<br />'           PARAMETERS:    B - Block to be put onto the screen.<br />'----------------------------------------------------------------------------<br />SUB PutBlock (b AS BlockType)<br />   <br />    SELECT CASE b.Rotation          ' Base exact placement on the rotation.<br />        CASE 0                      ' No rotation.<br />            x1 = b.X: y1 = b.Y<br />        CASE 1                      ' Rotated 90 degrees clockwise, or 270 degrees counterclockwise.<br />            x1 = b.X + 1: y1 = b.Y - 1<br />        CASE 2                      ' Rotated 180 degrees.<br />            x1 = b.X: y1 = b.Y<br />        CASE 3                      ' Rotated 270 degrees clockwise, or 90 degrees counterclockwise.<br />            x1 = b.X + 1: y1 = b.Y - 1<br />    END SELECT<br />   <br />    ' Actually PUT the rotated shape on the screen.  The XOR option makes the<br />    ' new image blend with whatever used to be there in such a way that<br />    ' identical colors cancel each other out.  Therefore, one PUT with the XOR<br />    ' option can draw an object while the second PUT to that same location<br />    ' erases it without affecting anything else near it.  Often used for animation.\n    PUT (x1 * XSIZE + WELLX, y1 * YSIZE + WELLY), BlockImage(((b.Style - 1) * 4 + b.Rotation) * ELEMENTSPERBLOCK), XOR  ' XOR mixes what used to be there on the screen with the new image.  Two identical colors cancel each other.\nEND SUB\n'----------------------------------------------------------------------------<br />' RedrawControls<br />'<br />'    Puts control keys information into the information box.<br />'<br />'           PARAMETERS:   None<br />'----------------------------------------------------------------------------<br />SUB RedrawControls<br />  <br />    ' Draw the InfoBox and erase anything that used to be in it.<br />    MakeInfoBox\n    ' Print the key assignments within the Info Box.<br />    COLOR BorderColor<br />    LOCATE 13, 4: PRINT &quot;Controls&quot;<br />    LOCATE 14, 4: PRINT &quot;--------&quot;<br />    LOCATE 15, 4: PRINT CHR$(24) + &quot; = Turn&quot;<br />    LOCATE 16, 4: PRINT CHR$(27) + &quot; = Left&quot;<br />    LOCATE 17, 4: PRINT CHR$(26) + &quot; = Right&quot;<br />    LOCATE 18, 4: PRINT CHR$(25) + &quot; = Drop&quot;<br />    LOCATE 20, 4: PRINT &quot;P = Pause&quot;<br />    LOCATE 21, 4: PRINT &quot;Q = Quit&quot;\nEND SUB\n'----------------------------------------------------------------------------<br />' Show<br />'<br />'    Draws the falling shape one block at a time.  Only used by<br />'    DisplayAllShapes.  After that, PutBlock draws all falling<br />'    shapes.<br />'<br />'           PARAMETERS:    B - Block to be put onto the screen.<br />'----------------------------------------------------------------------------<br />SUB Show (b AS BlockType)<br />                                                 <br />    ' Loop through all possible block locations.<br />    FOR i = 0 TO XMATRIX<br />        FOR j = 0 TO YMATRIX<br />           <br />            IF BlockShape(i, j, b.Style) = 1 THEN   ' 1 means there is a block there.<br />                 SELECT CASE b.Rotation             ' Exact screen position is determined by the rotation.<br />                    CASE 0                          ' No rotation.<br />                        DrawBlock b.X + i, b.Y + j, BlockColor(b.Style)<br />                    CASE 1                          ' Rotated 90 degrees clockwise, or 270 degrees counterclockwise.<br />                        DrawBlock b.X - j + 2, b.Y - 1 + i, BlockColor(b.Style)<br />                    CASE 2                          ' Rotated 180 degrees.<br />                        DrawBlock b.X + 3 - i, b.Y - j + 1, BlockColor(b.Style)<br />                    CASE 3                          ' Rotated 270 degrees clockwise, or 90 degrees counterclockwise.<br />                        DrawBlock b.X + j + 1, b.Y - i + 2, BlockColor(b.Style)<br />                END SELECT<br />            END IF<br />        NEXT j<br />    NEXT i\nEND SUB\n'---------------------------------------------------------------------------<br />' UpdateScoring<br />'<br />'    Puts the new score on the screen.  Checks if the new score forces<br />'    a new level.  If so, change the background pattern to match the<br />'    new level.<br />'<br />'           PARAMETERS:     None<br />'----------------------------------------------------------------------------<br />SUB UpdateScoring<br />   <br />    ' Increase the level if the score is high enough and the level is not<br />    ' maximum already.<br />    IF Level &lt; 9 AND Score &gt;= (NEXTLEVEL * (Level + 1) + PrevScore) THEN<br />   <br />        ' Store the entire well image to quickly PUT it back after the<br />        ' background changes.<br />        GET (WELLX, WELLY)-(WELLX + WELLWIDTH * XSIZE, WELLY + WELLHEIGHT * YSIZE), Temp<br />       <br />        PrevScore = Score           ' Save previous Score for next level.<br />        Level = Level + 1<br />        DrawPlayingField            ' Draw playing field again, this time with the new background pattern.<br />        PUT (WELLX, WELLY), Temp    ' Restore the image of the old well.<br />   <br />        RedrawControls              ' Show the controls again.<br />    END IF\n    LOCATE 7, 4: PRINT USING &quot;#,###,###&quot;; Score   ' Print the score and level.<br />    <br />END SUB</code></dd></dl><br /><br />Tee hee /Kappa<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=594">Jasoco</a> — Sun Jan 25, 2015 6:24 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jasoco]]></name></author>
<updated>2015-01-25T18:13:19+00:00</updated>
<published>2015-01-25T18:13:19+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179390#p179390</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179390#p179390"/>
<title type="html"><![CDATA[Support and Development • Re: [HELP] &lt;- PLEASE DON'T DO THIS]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179390#p179390"><![CDATA[
[HELP] Here's a thread title with absolutely no description of what my problem is but can you please look at it anyway? &lt;-- Please don't do this either<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=594">Jasoco</a> — Sun Jan 25, 2015 6:13 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jasoco]]></name></author>
<updated>2015-01-25T18:09:53+00:00</updated>
<published>2015-01-25T18:09:53+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179389#p179389</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179389#p179389"/>
<title type="html"><![CDATA[Support and Development • Re: Window being held issue]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179389#p179389"><![CDATA[
Just do what I said. At the top of the love.update() function put <span style="font-weight: bold">dt = math.min(dt, 1/30)</span>. If you want, change the 30 to 15 or something. It's literally <span style="font-style: italic">all</span> you need to do to fix this.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=594">Jasoco</a> — Sun Jan 25, 2015 6:09 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Reef]]></name></author>
<updated>2015-01-25T17:34:09+00:00</updated>
<published>2015-01-25T17:34:09+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179388#p179388</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179388#p179388"/>
<title type="html"><![CDATA[Support and Development • Re: Tetris piece collision]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179388#p179388"><![CDATA[
What I'm trying to do is loop through the template I have made for each piece, find out where the actual blocks are and where they are going to be given movement, then make sure that movement is on the game board, then make sure there are no existing pieces in the way. I've been ignoring the last part for now since I can't get a piece to stop in the proper position. I thought this would be the easy part, I haven't even started rotation or dealing with multiple pieces. Maybe I just need more test cases in my code?<br /><br />EDIT: I looked at my code again after sleeping and it seems like it was an off by one error. It is working as intended now, hopefully it's actually fixed. I think I understand what was going wrong.<br />Here it is for anyone wondering:<br /><dl class="codebox"><dt>Code: </dt><dd><code>local function isValidPosition(board, piece, dX, dY)<br />  -- return true if piece is within board and not colliding<br />  local valid = true<br />  for x = 1, PIECE_TEMPLATE_SIZE do<br />    for y = 1, PIECE_TEMPLATE_SIZE do<br />      local isAboveBoard = piece.y + y - 1 + dY &lt; 1  -- pieces should be allowed to be above the board<br />      <br />      if not (isAboveBoard or piece.rotation&#91;y&#93;&#91;x&#93; == 0) then  <br />        if not isOnBoard(x - 1 + piece.x + dX, y - 1 + piece.y+ dY) then<br />          valid = false<br />        elseif board&#91;y - 1 + piece.y + dY&#93;&#91;x - 1 + piece.x + dX&#93; ~= 0 then<br />          valid = false <br />        end<br />      end<br />    end<br />  end  <br />  return valid<br />end</code></dd></dl><p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=36559">Reef</a> — Sun Jan 25, 2015 5:34 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[S0lll0s]]></name></author>
<updated>2015-01-25T17:28:19+00:00</updated>
<published>2015-01-25T17:28:19+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179387#p179387</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179387#p179387"/>
<title type="html"><![CDATA[Support and Development • Re: [HELP] &lt;- PLEASE DON'T DO THIS]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179387#p179387"><![CDATA[
<blockquote><div><cite>Sosolol261 wrote:</cite><br /><blockquote><div><cite>Azhukar wrote:</cite>Hello everyone, I understand that at this very subforum page one individual used a [help] tag for his thread which caused a chain reaction of new users also adopting this tag.<br /><br />This tag serves absolutely no purpose and in fact makes it harder to read through the topic subjects, every single thread in this subforum is asking for help by default. That's what the subforum is for, you don't need to restate your intent of getting [help] in the title.<br /><br />If you want to be helpful with your tags then use a [solved] thread subject tag once your question gets answered.<br /></div></blockquote><br /><br />[HELP][QUESTION][MISUNDERSTANDING][?]why</div></blockquote><br /><span style="color: #FF0080"><span style="font-weight: bold"><span style="font-size: 150%; line-height: 116%;">[HELP] please help me out, getting error ★☆~HELP~☆★</span></span></span><p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135654">S0lll0s</a> — Sun Jan 25, 2015 5:28 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[S0lll0s]]></name></author>
<updated>2015-01-25T17:26:41+00:00</updated>
<published>2015-01-25T17:26:41+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179386#p179386</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179386#p179386"/>
<title type="html"><![CDATA[Support and Development • Re: Tetris piece collision]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179386#p179386"><![CDATA[
<blockquote><div><cite>Sosolol261 wrote:</cite><br />why dont you simplify it and make something like<br /><dl class="codebox"><dt>Code: </dt><dd><code>if block1PositionTop == block2PosBottom then<br />    blockMove = false<br />end<br /></code></dd></dl><br /><br />this is not working but i just wrote it to show you what i meant with 'simplifying' it.<br /></div></blockquote><br />The problem with something like this is that if the movement speed is anything other than 1 pixel / frame it might not stop, as it may go &quot;past&quot; the end point in a single frame. The correct way is doing it like this:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>if movingBlock.top + movingBlock.height &gt;= stationaryBlockBelow.top then<br />    movingBlock.top = stationaryBlockBelow.top + movingBlock.height -- move the block so it &quot;snaps&quot; in place correctly<br />end</code></dd></dl><br /><br />also note that for tetris, once a piece hits something and stops moving should be broken up into it's squares.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135654">S0lll0s</a> — Sun Jan 25, 2015 5:26 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[S0lll0s]]></name></author>
<updated>2015-01-25T17:22:06+00:00</updated>
<published>2015-01-25T17:22:06+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179385#p179385</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179385#p179385"/>
<title type="html"><![CDATA[Support and Development • Re: Camera follow player and update world]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179385#p179385"><![CDATA[
<blockquote><div><cite>Bindie wrote:</cite><br />Hello, I'm trying to experiment with room collision. First I want to make the camera follow the player, and the world being updated at the same time. However as I set the map_x and map_y to the player.x and player.y the camera slides off while walking with my player.<br /><br />Where is the problem in the code? Is there a awesome tutorial I can read? I am new to Löve.<br /><br />Bindie<br /></div></blockquote><br />because you move the map, not the camera, and also in the wrong direction.<br /><br />at the top of love.draw do: <dl class="codebox"><dt>Code: </dt><dd><code>love.graphics.translate( player.x, player.y )</code></dd></dl><br /><br />and also please upload <span style="font-style: italic">.love</span>s, not <span style="font-style: italic">.zip</span>s<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135654">S0lll0s</a> — Sun Jan 25, 2015 5:22 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Bindie]]></name></author>
<updated>2015-01-25T16:05:32+00:00</updated>
<published>2015-01-25T16:05:32+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179383#p179383</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179383#p179383"/>
<title type="html"><![CDATA[Support and Development • Camera follow player and update world]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79550&amp;p=179383#p179383"><![CDATA[
Hello, I'm trying to experiment with room collision. First I want to make the camera follow the player, and the world being updated at the same time. However as I set the map_x and map_y to the player.x and player.y the camera slides off while walking with my player.<br /><br />Where is the problem in the code? Is there a awesome tutorial I can read? I am new to Löve.<br /><br />Bindie<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136234">Bindie</a> — Sun Jan 25, 2015 4:05 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Doctory]]></name></author>
<updated>2015-01-25T11:30:10+00:00</updated>
<published>2015-01-25T11:30:10+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179376#p179376</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179376#p179376"/>
<title type="html"><![CDATA[Support and Development • Re: Window being held issue]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179376#p179376"><![CDATA[
that is unneeded. instead of dtc, use dt it is already supplied<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=134446">Doctory</a> — Sun Jan 25, 2015 11:30 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Drakkahn]]></name></author>
<updated>2015-01-25T11:04:43+00:00</updated>
<published>2015-01-25T11:04:43+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179375#p179375</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179375#p179375"/>
<title type="html"><![CDATA[Support and Development • Re: Window being held issue]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79487&amp;p=179375#p179375"><![CDATA[
Can someone please post code of this, all my attempts have failed.<br /><br />My Attempt<br /><dl class="codebox"><dt>Code: </dt><dd><code>function love.update(dt)<br /><br />   dtc_start=love.timer.getTime()<br />   <br />   --Process events<br />   <br />   dtc=love.timer.getTime()-dtc_start<br /><br />end</code></dd></dl><br /><br />Also for the enemy moving im using:<br /><dl class="codebox"><dt>Code: </dt><dd><code>self.x=self.x+100*dtc</code></dd></dl><p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136202">Drakkahn</a> — Sun Jan 25, 2015 11:04 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sosolol261]]></name></author>
<updated>2015-01-25T09:16:16+00:00</updated>
<published>2015-01-25T09:16:16+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179373#p179373</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179373#p179373"/>
<title type="html"><![CDATA[Support and Development • Re: Tetris piece collision]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179373#p179373"><![CDATA[
why dont you simplify it and make something like<br /><dl class="codebox"><dt>Code: </dt><dd><code>if block1PositionTop == block2PosBottom then<br />    blockMove = false<br />end<br /></code></dd></dl><br /><br />this is not working but i just wrote it to show you what i meant with 'simplifying' it.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135953">Sosolol261</a> — Sun Jan 25, 2015 9:16 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Sosolol261]]></name></author>
<updated>2015-01-25T09:13:10+00:00</updated>
<published>2015-01-25T09:13:10+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179372#p179372</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179372#p179372"/>
<title type="html"><![CDATA[Support and Development • Re: [HELP] &lt;- PLEASE DON'T DO THIS]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179372#p179372"><![CDATA[
<blockquote><div><cite>Azhukar wrote:</cite><br />Hello everyone, I understand that at this very subforum page one individual used a [help] tag for his thread which caused a chain reaction of new users also adopting this tag.<br /><br />This tag serves absolutely no purpose and in fact makes it harder to read through the topic subjects, every single thread in this subforum is asking for help by default. That's what the subforum is for, you don't need to restate your intent of getting [help] in the title.<br /><br />If you want to be helpful with your tags then use a [solved] thread subject tag once your question gets answered.<br /></div></blockquote><br /><br />[HELP][QUESTION][MISUNDERSTANDING][?]why<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=135953">Sosolol261</a> — Sun Jan 25, 2015 9:13 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Joe Black]]></name></author>
<updated>2015-01-25T08:55:58+00:00</updated>
<published>2015-01-25T08:55:58+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179370#p179370</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179370#p179370"/>
<title type="html"><![CDATA[Support and Development • Re: [help] drawing with transparency]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79540&amp;p=179370#p179370"><![CDATA[
thanks Hugo<br />but the overlapping of tile don't cover the gap<br /><br /><a href="http://www.hostingpics.net/viewer.php?id=668326recouvrement.png" class="postlink"><img src="http://img4.hostingpics.net/thumbs/mini_668326recouvrement.png" alt="Image" /></a><br /><br />actually the &quot;gap&quot; is made by borderline of the tile.<br />I think the border of the tile is in .png slightly transparent and so tiled(the editor) when overlapping(because we can see that in isometric mode the border line of tile is always overlapping with others) make the sum with the color below or something like that. Whereas in love.graphics.draw it just draw the color that is in the .png only pixel that are totally transparent are not drawn.<br /><br />one solution is to recreate tiles in order erase this border line  and paint it fully colored and as far as possible don't make tile overlapping.<br /><br />But if someone know how tiled draw that and could indicate me some article or whatever thanks<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=136219">Joe Black</a> — Sun Jan 25, 2015 8:55 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Reef]]></name></author>
<updated>2015-01-25T08:54:26+00:00</updated>
<published>2015-01-25T08:54:26+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179369#p179369</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179369#p179369"/>
<title type="html"><![CDATA[Support and Development • Tetris piece collision]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79549&amp;p=179369#p179369"><![CDATA[
If any of you are pros at debugging, I would appreciate some help with what seems to be an off by one problem that I can't seem to solve.  I'm slowing building an implementation of Tetris but I'm having trouble with the rules with piece movement. <br /><br />Currently, the pieces fall to the bottom of the well but stop one space short of the bottom. Any attempt to fix this has just resulted in errors, such as nil values for tables I'm accessing.<br /><br />I've been using Zerobrane Studio for it's extremely helpful debug tools but I haven't solved the problem. I believe it's related to my isValidPosition() function. Not being having a way to Continue in lua gave me some trouble. <br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>local function isValidPosition(board, piece, dX, dY)<br />  -- return true if piece is within board and not colliding<br />  local valid = true<br />  for x = 1, PIECE_TEMPLATE_SIZE do<br />    for y = 1, PIECE_TEMPLATE_SIZE do<br />      local isAboveBoard = piece.y + y + dY &lt; 1  -- pieces should be allowed to be above the board<br />      <br />      if not (isAboveBoard or piece.rotation&#91;y&#93;&#91;x&#93; == 0) then  <br />        if not isOnBoard(x + piece.x + dX, y + piece.y + dY) then<br />          valid = false<br />        elseif board&#91;y + piece.y + dY&#93;&#91;x + piece.x + dX&#93; ~= 0 then<br />          valid = false <br />        end<br />      end<br />    end<br />  end  <br />  return valid<br />end</code></dd></dl><br /><br />However, the problem could likely be elsewhere; I've made a bit of a mess trying to fix this problem and the code isn't very clear any more.<br /><br />Any help? Any other tips that would make my life easier or advice for implementing Tetris? This has proven much harder than I anticipated, I have trouble with grid based games.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=36559">Reef</a> — Sun Jan 25, 2015 8:54 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Doctory]]></name></author>
<updated>2015-01-25T08:37:01+00:00</updated>
<published>2015-01-25T08:37:01+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179368#p179368</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179368#p179368"/>
<title type="html"><![CDATA[Support and Development • Re: [HELP] &lt;- PLEASE DON'T DO THIS]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179368#p179368"><![CDATA[
+1 i vote azhukar for president<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=134446">Doctory</a> — Sun Jan 25, 2015 8:37 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Azhukar]]></name></author>
<updated>2015-01-25T08:34:49+00:00</updated>
<published>2015-01-25T08:34:49+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179367#p179367</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179367#p179367"/>
<title type="html"><![CDATA[Support and Development • [HELP] &lt;- PLEASE DON'T DO THIS]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79548&amp;p=179367#p179367"><![CDATA[
Hello everyone, I understand that at this very subforum page one individual used a [help] tag for his thread which caused a chain reaction of new users also adopting this tag.<br /><br />This tag serves absolutely no purpose and in fact makes it harder to read through the topic subjects, every single thread in this subforum is asking for help by default. That's what the subforum is for, you don't need to restate your intent of getting [help] in the title.<br /><br />If you want to be helpful with your tags then use a [solved] thread subject tag once your question gets answered.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=71132">Azhukar</a> — Sun Jan 25, 2015 8:34 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[adrix89]]></name></author>
<updated>2015-01-25T07:10:41+00:00</updated>
<published>2015-01-25T07:10:41+00:00</published>
<id>http://love2d.org/forums/viewtopic.php?t=79544&amp;p=179366#p179366</id>
<link href="http://love2d.org/forums/viewtopic.php?t=79544&amp;p=179366#p179366"/>
<title type="html"><![CDATA[Support and Development • Re: Switch Statement?]]></title>

<category term="Support and Development" scheme="http://love2d.org/forums/viewforum.php?f=4" label="Support and Development"/>
<content type="html" xml:base="http://love2d.org/forums/viewtopic.php?t=79544&amp;p=179366#p179366"><![CDATA[
Lua-users has a pretty in depth look at lua switch.<br /><!-- m --><a class="postlink" href="http://lua-users.org/wiki/SwitchStatement">http://lua-users.org/wiki/SwitchStatement</a><!-- m --><br /><br />You probably don't need anything more then a table and if statements.<p>Statistics: Posted by <a href="http://love2d.org/forums/memberlist.php?mode=viewprofile&amp;u=1539">adrix89</a> — Sun Jan 25, 2015 7:10 am</p><hr />
]]></content>
</entry>
</feed>