
A complete narrated video-tutorial series of how to create a SameGame mini-game is available on my Youtube channel now! It is made with Ren'Py's own scripting language together with Python code. It consists of 11 parts where we implement:
A grid of icons/objects that can be interacted with to remove a group of matches.
Grid/Icon shuffling functionality where the icons will shift into empty columns and rows to fill in gaps.
A simple scoring system where the player gets points for each removed icon on the grid.
A countdown timer that counts down from 60 seconds to 0.
A game-over screen that triggers when the time is up and shows the player their final score.

You can download the complete script and artwork for this tutorial below.
Artwork: Download (Dropbox)
UPDATE v.1.0.1: The script has been updated to work with Ren'Py version 8.0. The new version of Ren'Py is now using Python 3 instead of 2. As such, somethings aren't working correctly in the original version of this script. I have updated it now to work for the new version.
The thing that is affecting the script is in regards to Python 3's new way of handling divisions. All divisions in Python 3 now results in floats instead of integers. It is vital for the this scripts functionality that the values are integers. Read the changes below to learn more.
Changes made to the script:
The calculations for the frame size inside the SameGame screen have been typecasted to integers so that the sizing will work correctly for the frame.
Code (no need to copy paste this, just download the updated script below):
screen SameGame:
$frame_xsize = (icons_per_row * icon_size) + (icons_per_row * icon_padding) + icon_padding + 4
$frame_ysize = int((grid_size / icons_per_row) * icon_size) + int((grid_size / icons_per_row) * icon_padding) + icon_padding + 4
In the shiftIcons() function, the for loop has been changed to typecast the calculation inside of the range() function call to integers, so the for loop works correctly.
Code:
for icon in range(int(grid_size / icons_per_row)):
UPDATE V.1.0.2: The script has been updated with some code improvements and is also now commented. Here's a summary of the more important changes:
The "shift_icons" function have a bug fixed where the icons would shift back to their old coordinates after pressing the "hint" button. The "posx" and "posy" attributes for the icons just needed updating as well as their "x" and "y" attributes.
Variables in the start label have been moved above it using the default statement.
The "setup_icons" label have been re-made into a function instead. Sample of how to use it is in the start label and "hint" function and works pretty much the same way.
Project files attached below.