Part III GET THE CODE IN THE DESCRIPTION (Tetris game)

Опубликовано: 06 Август 2026
на канале: Utso Sarkar
97
8

The complete code of this program is in the link below:-
go to this link and copy the complete program, and run it to play.....

  / a-small-basic-code-to-make-tetris-game  

#######PLEASE SUBSCRIBE AND PRESS THE BELL ICON############

&&&&&&&&&PLEASE LIKE THIS VIDEO, IF YOU ENJOYED&&&&&&&&&&



And this is the part of the code that you need to copy:-----


Sub SetupCanvas
' GraphicsWindow.DrawResizedImage( Flickr.GetRandomPicture( "bricks" ), 0, 0, GraphicsWindow.Width, GraphicsWindow.Height)


GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor
GraphicsWindow.FillRectangle(XOFFSET, YOFFSET, CWIDTH*BWIDTH, CHEIGHT*BWIDTH)

Program.Delay(200)
GraphicsWindow.PenWidth = 1
GraphicsWindow.PenColor = "Pink"
For x = 0 To CWIDTH-1
For y = 0 To CHEIGHT-1
Array.SetValue("c", x + y * CWIDTH, ".") ' "." indicates spot is free
GraphicsWindow.DrawRectangle(XOFFSET + x * BWIDTH, YOFFSET + y * BWIDTH, BWIDTH, BWIDTH)
EndFor
EndFor

GraphicsWindow.PenWidth = 4
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawLine(XOFFSET, YOFFSET, XOFFSET, YOFFSET + CHEIGHT*BWIDTH)
GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH, YOFFSET, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH)
GraphicsWindow.DrawLine(XOFFSET, YOFFSET + CHEIGHT*BWIDTH, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH)

GraphicsWindow.PenColor = "Lime"
GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET, XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 6)
GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 6)
GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 4, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 4)

GraphicsWindow.PenColor = "Black"
GraphicsWindow.BrushColor = "Pink"
x = XOFFSET + PREVIEW_xpos * BWIDTH - BWIDTH
y = YOFFSET + PREVIEW_ypos * BWIDTH - BWIDTH
GraphicsWindow.FillRectangle(x, y, BWIDTH * 5, BWIDTH * 6)
GraphicsWindow.DrawRectangle(x, y, BWIDTH * 5, BWIDTH * 6)

GraphicsWindow.FillRectangle(x - 20, y + 190, 310, 170)
GraphicsWindow.DrawRectangle(x - 20, y + 190, 310, 170)

GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontItalic = "False"
GraphicsWindow.FontName = "Comic Sans MS"
GraphicsWindow.FontSize = 16
GraphicsWindow.DrawText(x, y + 200, "Game control keys:")
GraphicsWindow.DrawText(x + 25, y + 220, "Left Arrow = Move piece left")
GraphicsWindow.DrawText(x + 25, y + 240, "Right Arrow = Move piece right")
GraphicsWindow.DrawText(x + 25, y + 260, "Up Arrow = Rotate piece")
GraphicsWindow.DrawText(x + 25, y + 280, "Down Arrow = Drop piece")
GraphicsWindow.DrawText(x, y + 320, "Press to stop game")

Program.Delay(200) ' without this delay, the above text will use the fontsize of the score

GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontName = "Georgia"
GraphicsWindow.FontItalic = "True"
GraphicsWindow.FontSize = 36
GraphicsWindow.DrawText(x - 20, y + 400, "Small Basic Tetris")
Program.Delay(200) ' without this delay, the above text will use the fontsize of the score
GraphicsWindow.FontSize = 16
GraphicsWindow.DrawText(x - 20, y + 440, "ver.1.2 by Arjo")

Program.Delay(200) ' without this delay, the above text will use the fontsize of the score
score = 0
PrintScore()
EndSub