Tetris : Recreation of 1980's Retro game

A simple extension for developing Tetris Game.

Designer Properties


BackgroundMusic text Sets source of background music of game [Will be only played if Enable music is true].
CurrentScore number Sets a current score of Tetris Game.
DbName text Specifies custom name for shared preferences of Game's database [Can be also accessible using TinyDB component].
EnableMusic boolean Sets if music must be played, [Default : true]
GameOverMessage text Specifies text for Game Over dialog's message [Note : Only Displayed if UseDefaultAlerts() is true.
GameOverTitle text Specifies text for Game Over dialog [Note : Only Displayed if UseDefaultAlerts() is true.
TopScore number Sets top score of game's database.
TopScoreTagName text Specifies custom name for shared preferences tag of Game's top score.
TryAgainText text Specifies text for Game Over dialog try again button [Note : Only Displayed if UseDefaultAlerts() is true.
UseDefaultAlerts boolean If enabled, default game dialogs will be displayed [Default Value : true].
ViewLayout component Specifies a layout for Tetris Rendering View.

Blocks

AddCellImage

image

Adds cell with the specified image and index

CreateRenderer

image

Creates an instance of Tetris View renderer.

DecreaseMusicVolume

image

Decreases game's background music by 10%.

DestroyInstance

image

Destroys and removes Tetris View from Layout [Note : Recall CreateRenderer() after using this or Error will be raised].

GetCurrentScore

image

Returns current score of game.

GetTopScore

image

Returns Top Score of Tetris Game.

IncreaseMusicVolume

image

Increases game's background music by 10%.

IsGameOver

image

Tells if the game is over.

IsRendererInitialized

image

Tells if Tetris Renderer is initialized.

MoveBlockToBottom

image

Moves the upcoming block to bottom, gets stacked on other blocks if any.

MoveBlockToLeft

image

Moves the upcoming block to left.

MoveBlockToRight

image

Moves the upcoming block to right.

MuteMusic

image

Mutes/Disables sound of games background music.

PauseGame

image

Pauses the instance of Tetris Game.

PauseMusic

image

Pauses background music of game.

Redraw

image

Redraws Tetris view.

ResetTopScores

image

Resets top score from game's database.

ResumeGame

image

Resumes the game [Note : Use only after calling PauseGame()].

ResumeMusic

image

Resumes background music of game [Note : Only use after calling PauseMusic()].

RotateBlock

image

Rotates the upcoming block clock wise.

StartGame

image

Starts the game.

StopMusic

image

Stops background music of game.

Properties

Event Blocks


Output

I didn't make a complex app for demo.

Credits: @anke for Activity lifecycle extension.

Demo Blocks

Designer

Blocks

Aia

TetrisDemoAi2.aia (538.7 KB)

Assets Pack

Aix

Tetris (23).aix (29.6 KB)

20 Likes

3 Likes

does it make any sense to pack a whole game as aix? I have seen this one and other one like tic tac toe.

1 Like

You may use music enabled property and set it to false.

1 Like

Yes, it seems that your extension with Companion has the wrong path to the assets. APK works.

The paths to the assets are different for Android β‰₯ 10 and < 10. See here:

3 Likes

Accessing data of game from TinyDB component

If you leave DbName property to default, then set namespace to gamedb else input same value you specified in DbName.

image

Access Data
image

1 Like

Mind blowing extension @Know_About_IT

1 Like

Very nice aix !!! :exploding_head:

1 Like

Really wanted this! Thank you :slight_smile: :heart: :heart: :heart: :star::star::star::star::star: 5 stars

1 Like

Amazing extension

2 Likes

are you using any library? If yes, please credit the library author
Why it’s a good idea to give credit by Corey Wainwright.

Taifun

3 Likes

Nope, not a library, i took reference from some open source GitHub projects

Then please add external links to the GitHub projects.

3 Likes

Umm why? reference is not using the full library but just really small parts of code .

That is still work from others. As you can see from these screenshots, other developers also give credit.

2 Likes

An example except taifun? look taifun is very good and gives credit for every small things but in case of me and others i dont remember from where i take references because i look at a lot of codes for reference so i cant give credit for 100 codes.
Try to understand. :sweat:

2 Likes

However I have customized it much [listeners, custom db, colors, music,etc]

I will make my sources public soon too :slight_smile:

5 Likes

You might want to add this reference by editing your topic :slight_smile:

1 Like

Nice job.

In the world of App Inventor having an index of 0 is strange. Indexes start with 1. So to make this work...

I have to subtract a 1 from the index.

Can you change the extension so it accepts 1 as the start of the index instead of 0?

2 Likes