Jump to content


Photo
* * * * * 4 votes

Match3 Game Engine Tutorial


  • Please log in to reply
44 replies to this topic

#1 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 29 May 2014 - 10:31 AM

  • Title: Match3 Game Engine
  • Description: Tutorial on creating a match3 puzzle game
  • GM Version: GM Studio
  • Registered: No
  • File Type: ZIP
  • File Size: 15.6Mb
  • File Link: Match3 Game Engine
  • Required Extension: None
  • Required DLL: None
  • Tags: match3 source, match3 engine, match3 game

Summary
This tutorial shows how to make a match3 game similar to Bejeweled. It contains the fully working game mechanics which you can add to and modify to create your own match3 game variant with.

There are several variations of Match 3-In-A-Line games but the basic mechanics remains essentially the same. Match 3 or more items the same across or down to remove them from the playfield. Version variants allow items to be swapped from anywhere, only allow a swap if a matching item exists, limit the swaps available or also allow diagonal matches as well.

This Match3 Game Engine adheres more closely to the original "Bejeweled" type game, allowing only adjacent pieces to be swapped to match three in a line across or down, diagonal matches do not count. It can however be modified to create variants.
 
match3_engine.png
Description

As supplied the Match3 Game Engine is a fully working editable example containing the bare-bones mechanics which can be used without credit or acknowledgement – even for commercial titles!

It comes with comprehensive documentation to help you to modify it to create your own Match3 game Masterpiece your way with the minimum of effort. It is aimed at intermediate GML users and uses some of the more advanced techniques however novices can also learn from it.

Many customizations can be done with the minimum of coding experience by simply changing some of its resources. Those more conversant with GML or those willing to "try" can modify it to change how the game-play works or add to its functionality.

The main focus of the documentation is in detailing how the basic mechanic work however it also includes step by step instructions on adding to its (rather basic) functionality.

These include:

  • Changing its graphics.
  • Modifying how it works.
  • Adding a High Score System
  • Adding Game Saving and Loading
  • Adding a Level Timer

The Example Match3 Game (Loopy Fruits) is functional rather than pretty. Its menus are bland (begging you to add backgrounds) and as a game it lacks some of the additions listed above – That is your challenge, but it works and has proved to be robust.

To help you the documentation (some 47 pages in PDF format) details more than you could hope for.

Its resources have been kept to a minimum to also allow users of the Free version of Game Maker Studio to create a fully functional Match3 game of their making.

Match3 Game Engine (ZIP Archive - Avg Download 5.34 times per day)

 

Instructions:

Download to a destination of your choice.

Unpack the ZIP archive to obtain the GMZ import and PDF Documentation.

 

Disclaimer Note:
This tutorial is provided 100% free. You may use or alter its source code any way you see fit but it is supplied without warranty. You can copy and make the download package available to others providing it is supplied unaltered and it remains free – You cannot claim ownership of the tutorial, alter its documentation or sell it. The project source code and graphic resources are Open Source and yours to do with as you please.
 
Edit: Updated for V1.4 (Stable).
 


Edited by Noele, 09 January 2016 - 08:53 AM.

  • 13

#2 chance

chance

    GMC Member

  • Global Moderators
  • 8762 posts
  • Version:GM:Studio

Posted 29 May 2014 - 11:32 AM

Without a doubt, this is the most extensive tutorial I've seen in this forum.  It is among the best explained and best written examples here. 

 

To say it's a tutorial about "match three games" doesn't really describe it.  Because it includes extensive  explanation of many aspects of GameMaker -- such as paths, particles, timers, health bars, heads-up displays, high-score tables, loading and saving, asynchronous events, etc, etc.  Even if you're not interested in match three games, I would still urge people to look at this.

 

The GML code itself contains ample comments, and the accompanying PDF file is a remarkable resource for beginners and intermediate users.  Not only about coding, but about many aspects of good design choices.

 

Very well done!  This is an excellent contribution to the GMC forum. 


  • 0

#3 dodgingcars

dodgingcars

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 29 May 2014 - 03:05 PM

Thank you so much for this. I've been planning a variation on a match 3 style game and this will certainly help!!


  • 0

#4 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 29 May 2014 - 07:57 PM

I thank everyone for their kind remarks however I have good and bad news.

The bad news is I discovered an error - an oversight more than an error. The good news is I fixed it and updated the game and documentation accordingly.

 

The issue was:

As extra items above the playfield don't actually exist and new items are not created whilst there are extra items waiting to be produced, I found it was possible to have too few of any item to match leaving the player no option but to quit.

 

This has been corrected and it will now create more of an item if less than 3 of all remaining items exist regardless of the number of extra items there are waiting to be produced.

 

This will not apply to those of you who don't want this "feature" and have removed it. In your case too few of an item type causes the level to be failed, thus illiminating the problem arrising.

 

I appologize for any inconvienience - It was not a senario likely to happen often but once is too often and the download was updated.


Edited by Noele, 29 May 2014 - 08:09 PM.

  • 0

#5 Astralite

Astralite

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 02 June 2014 - 09:13 PM

There should be a timer between being allowed to swap fruit...if you click them fast enough you can shift around multiple fruit (3-4 at a time), which can result in them going in wild directions, occupying the same space as others, or even "falling out" of the playfield under the game


  • 0

#6 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 03 June 2014 - 09:26 AM

A simpler fix would be to reset global.clicked by adding an extra line to the Left Released event.

// No longer exists or this instance was already selected
// Reset all items and exit
global.clicked = noone; // added this line

The downside is it may not appear as responcive on some systems/platforms but should be better than using an alarm.


  • 0

#7 Wolf Dreamer

Wolf Dreamer

    GMC Member

  • GMC Member
  • 227 posts
  • Version:GM:HTML5

Posted 19 June 2014 - 03:03 PM

30cytft.png

 

I get this game stopping error at the start of a game.  It says "Too few items to match", but I just started, and there are plenty of items to match.

 

Other bug I noticed was is if you click "options" during a game, you can not continue.

 

And of course, like many things made with GameMaker Studio, doesn't work in Firefox for some reason, but works fine in Chrome, so its just a Firefox issue I suppose.

 

Great game though.  I look forward to reading through the tutorial and figuring out how everything works.  Thank you for uploading this.


  • 0
Wolf Dreamer
The last sane human being in a world gone mad

#8 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 19 June 2014 - 05:26 PM

I am guessing you have inadvertantly altered or removed something of importance.

 

As supplied it is just the bare bones mechanics primarily for PC use but it can be modified and used on other platforms. The HTML5 platform is arguably the most restrictive but can still be used although not using the built-in game saving and loading functions (The GM manual recommends creating your own game saving mechanism in any case)


  • 0

#9 Wolf Dreamer

Wolf Dreamer

    GMC Member

  • GMC Member
  • 227 posts
  • Version:GM:HTML5

Posted 19 June 2014 - 10:06 PM

I didn't alter a thing.  I just download it, opened it up, and then ran it with HTML5 through Chrome.


  • 0
Wolf Dreamer
The last sane human being in a world gone mad

#10 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 20 June 2014 - 08:18 AM

Sadly it does not automatically adjust its coding to suit all platforms. Widescreen support for example doesn't suit all platforms but it is only of benefit to PC use anyway. The basic mechanism can work on all platforms but you do have to alter some things.


  • 0

#11 tomasart

tomasart

    GMC Member

  • GMC Member
  • 269 posts

Posted 24 June 2014 - 10:20 AM

great


  • 0

#12 Dhiyananth

Dhiyananth

    GMC Member

  • GMC Member
  • 134 posts
  • Version:GM:Studio

Posted 18 July 2014 - 11:25 AM

Really a great tutorial.... Thanks...

It's really worth.. I'm getting know about new things on how to use some functions and other terms.

 

And i have a doubt, I tried to run the game in win8native and my pc's screen resolution is 16:9.

so it's a wide screen display that you know...

 

The autodetect option for the widescreen display is not getting work in my case.

But if i tried it by forcing to convert,the widescreen display is working.

 

What's the reason..?


  • 0

#13 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 18 July 2014 - 12:19 PM

It is set to detect a 16:9 ratio for widescreen, which is the most common however some (usually older) widescreens use 16:10.

I suspect this may be the reason.


  • 0

#14 Dhiyananth

Dhiyananth

    GMC Member

  • GMC Member
  • 134 posts
  • Version:GM:Studio

Posted 18 July 2014 - 12:42 PM

It is set to detect a 16:9 ratio for widescreen, which is the most common however some (usually older) widescreens use 16:10.

I suspect this may be the reason.

 

 

No i even tried with the emulator... The ratio is 16:9(1366X768).

The problem is still there..

Is there anyway to adjust the game to work for 16:10 ratio also...?

 

And you know that when the user moves to snap view in win8native ,it is difficult to design a pause screen in the aspect ratio mode, as the screen get's shrink according to the aspect ratio.

So,is there anyway to solve this problem,,,?


  • 0

#15 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 18 July 2014 - 01:03 PM

There is a section in the documentation accompanying the download which explains how to calculate and adjust the display ratio.

Note that not all resolution sizes conform to a standard 16:9 ratio - some screen resolutions are graphics card / handler specific, which is largely out of your control.

 

1280 by 720 is a common standard widescreen size 1280 / (16 / 9) = 720


  • 0

#16 buck_rogers

buck_rogers

    GMC Member

  • New Member
  • 7 posts
  • Version:GM8.1

Posted 24 July 2014 - 11:39 PM

Thank you very much for this.  Can you tell me if there is a way to make the items slide faster?  When you click the first fruit, then the second, they transpose.  Can the speed at which the switch places be changed?


  • 0

#17 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 25 July 2014 - 08:15 AM

 

Can you tell me if there is a way to make the items slide faster?

This is quite easy. When swapping places each item plots a path to each other so you can adjust the speed by altering the path speed for both.

Items Object, Left Pressed Event has this:

  path_clear_points(item1_path);
  path_add_point(item1_path,x,y,100);
  path_add_point(item1_path,global.clicked.x,global.clicked.y,100);
  with (global.clicked){
    path_clear_points(item2_path);
    path_add_point(item2_path,x,y,100);
    path_add_point(item2_path,other.x,other.y,100);
    path_start(item2_path,3,0,true);                // <<<< Change 3 to the speed you want
    instance_create(x,y,obj_marker);
  }
  path_start(item1_path,3,0,true);                  // <<<< Change 3 to the same speed

This simply clears two existing paths of points before plotting new ones, one for this item and another to the previousy selected one. It then starts both paths at a speed of 3. As they are fixed paths the speed will not affect collisions - that is, they can't overrun no matter how fast the "swap".


  • 0

#18 buck_rogers

buck_rogers

    GMC Member

  • New Member
  • 7 posts
  • Version:GM8.1

Posted 26 July 2014 - 03:39 AM

Appreciated.

 

 

There was a mention in the instructions about using beware of the temptation to use hi-res graphics and how that might slow things down.  Is that because of GameMaker?  It just isn't made for those kind of graphics like on Candy Crush or Bejeweled?  Is GM more for the 8-bit look?


  • 0

#19 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 26 July 2014 - 07:22 AM

Actually it is more to do with target platform limitations and machine / device specifications. A game using lots of hi-res graphics will consume a lot more system memory, thus requiring more graphics processing. Mobile decices don't offer the same processing power as a PC but in many cases you don't need hi res graphics in any case.

 

The keyword here is "compromize". Graphics and sound often take the lion's share of memory. GM compresses game data (to help make loading quicker) which must be decompressed after loading and additional memory allocated for processing depending upon the game logic. A 13Mb executable can easilly require 50Mb to actually run. The larger the resource memory requirement the less their will be for actual processing.

 

Neither Candy Crush or Beejeweled use particularly high res graphics.


  • 0

#20 rajasi

rajasi

    GMC Member

  • GMC Member
  • 26 posts
  • Version:GM:Studio

Posted 31 August 2014 - 05:11 PM

Hi Noele, thanks for this tutorial.

 

Instead of just modifying it to my purposes, I'm trying to bring it in my own project piece by piece.

 

Now I've got the grid, the collisions, the spawners, the basic controls. What I don't have as yet is integrating

the check_playfield and the levelling/score/etc. 

 

so all it does is to spawn the elements on the grid, you can click, they pulse and you should be able to swap place

but something odd happens. When the path_start, the 2 blocks move correctly but then at the end of their path

instead of stopping therefore taking each other's place they go back to their original spot.

 

the code that does the path calculation is exactly the same as in your tutorial, as well as the End Path event. 

The endaction in the path_start() is zero which should stop any further movements after the path ended.. but it doesn't do that.

 

I'm using Early Access at moment, hopefully is not a glitch. 

 

Any idea or place in your code where this is checked that I may have overlooked?

 

thanks, appreciate your help :)


  • 0

#21 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 31 August 2014 - 05:22 PM

Do you have the paths set to closed? A closed path goes back to its start position.


  • 1

#22 rajasi

rajasi

    GMC Member

  • GMC Member
  • 26 posts
  • Version:GM:Studio

Posted 31 August 2014 - 05:31 PM

WOW!!

 

thanks for the fastest reply ever :)

 

Indeed I had the path closed, I didn't even thought about that as I'm not so familiar with paths. 2 hours of my life wasted checking the code character after character and the problem was in the path's resource

 

That solved the issue and it is now working flawlessly :)

 

thanks again!


  • 0

#23 Quzziy

Quzziy

    GMC Member

  • New Member
  • 3 posts
  • Version:GM:Studio

Posted 02 September 2014 - 12:57 PM

Thanks man, I will study this engine 


  • 0

#24 ThisWonderful2D

ThisWonderful2D

    GMC Member

  • New Member
  • 1 posts
  • Version:GM:Studio

Posted 08 September 2014 - 09:52 AM

The link is broken

This site is temporarily unavailable


Edited by ThisWonderful2D, 08 September 2014 - 09:53 AM.

  • 0

#25 abhimathur

abhimathur

    GMC Member

  • New Member
  • 1 posts
  • Version:Unknown

Posted 11 September 2014 - 10:12 AM

Hi Noele,

 

The tutorial links seems to be broken, can you please have a look , It would be of great help since I am in urgent need of some guidance on logic development for match 3 game engine


  • 0

#26 solcacto

solcacto

    GMC Member

  • GMC Member
  • 20 posts
  • Version:Unknown

Posted 12 September 2014 - 11:04 PM

Please re-up the link.


  • 0

#27 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 13 September 2014 - 07:33 PM

Appologies to all. Links (in first post) updated.

 

We are in the process of moving to a new web host with a new domain and what seemed fairly simple got complicated when several CGI scripts failed to operate on the new system configuration. This was also true of the downloader system. The main site is still being constructed (not uploaded) but the new download system is in place and is (slowly) being re-populated

 

My regrets for any inconvienience.


  • 0

#28 solcacto

solcacto

    GMC Member

  • GMC Member
  • 20 posts
  • Version:Unknown

Posted 14 September 2014 - 01:37 AM

Great, thanks for that!


  • 0

#29 degzie

degzie

    GMC Member

  • GMC Member
  • 197 posts
  • Version:GM8

Posted 06 January 2015 - 11:57 AM

First, thanks for making this freely available for everyone to learn. It has the exact basic functionality that anyone would need to play around with this type of game.  I will be using it for a game I'm doing & will give credit to the author (and hopefully send a donation).  I have a couple of questions:

 

1. I have replaced the images with my own & resized them to 64x64, but there is a 2 pixel empty border around the image.  The mask for the image is the full image rectangle (auto).  I notice that sometime when you swap  tiles that they get stuck between each other - not always in the same place.  I was wondering if anyone else has seen that.  It' not easily producible so may be a timing thing - I'll download the vanilla demo & try & make it happen on that.  Also worth noting if I start messing around with blocks nearby, it will sometimes come out of that collision & place them back where there's a space.

 

2. Hint system.  Since this is a basic engine there is no hint system.  I'm trying to get my head around how to implement that since there are no arrays to check, it's done at runtime against instances.  I'd also like to use that same code so if it checks for a hint & can't find one then it will shuffle the blocks up.  I'm not looking for the code here .. just some tips on the best way to approach adding a hint system to this specific engine.

 

Thanks

 

 


  • 0

Spoiler

MOD EDIT: You signature is taller than the permitted total height of 150px and has been spoilered. Please fix.


#30 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 06 January 2015 - 01:16 PM

1) When you replaced the item sprites did you also resize the (invisible) block sprite to match the size? The system uses the width of the sprite as the size to position it so it should self-adjust.

2) The playfield setup uses RANDOM and with random you get uncertainty, which makes predicting matches difficult. For a hint system I would probably advise using data structures to map out possible moves. The drawback with this may be performance takes a hit on some platforms, such as HTML5.


  • 0

#31 degzie

degzie

    GMC Member

  • GMC Member
  • 197 posts
  • Version:GM8

Posted 06 January 2015 - 01:44 PM

Thanks for the reply.

 

1) No I haven't done that, surprised it even works as I think the original size was 48x48 .. I'll give that a go later.

 

2) Ok, I think I will try & write something that scans the tiles & stores them in an array/grid or something like that then write something to scan for possible moves.  I found some general info on stackexchange.. so something like this (for an 8x8 - but will work for others)

 

  • Iterate the whole grid, starting from top left.

    • At every point on the grid until and including the 6th column, check one tile right, and down (you do not need to check left and up because you've done this)

    • If they match, then try checking one more tile along/down. If they don't, move to the next tile along. Handle out-of-board errors as 'not the same'.

    • When you finish the 8th column, move down a row.

    • If you get a match then store that location in the array/grid - then you can 'flash' that later on

    • If no possible matches - then code for a reshuffle of the tiles


  • 0

Spoiler

MOD EDIT: You signature is taller than the permitted total height of 150px and has been spoilered. Please fix.


#32 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 06 January 2015 - 03:14 PM

The match checking script already checks the entire playfield so maybe you could duplicate it and alter it. Instead of setting variables in any which match, maybe get it to add the instance ID to a data structure? You could then fetch an instance ID to use as the hint.


  • 0

#33 degzie

degzie

    GMC Member

  • GMC Member
  • 197 posts
  • Version:GM8

Posted 06 January 2015 - 04:19 PM

Yeah that sounds good.  I'll report back on how I get on :)  I think using grids as my data structure should make this pretty straight forward.


  • 0

Spoiler

MOD EDIT: You signature is taller than the permitted total height of 150px and has been spoilered. Please fix.


#34 degzie

degzie

    GMC Member

  • GMC Member
  • 197 posts
  • Version:GM8

Posted 08 January 2015 - 03:23 PM

Hi, just to say that I have the hints working.  I did as you said & took a copy of  the script that checks for matches, removed most of it apart from the 2 for loops, and  store the image number & ID of each block in to a grid, actually 2 grids as it was the simplest/quickest way.

 

I then worked out the combinations & wrote another script to check the block to the right to see if it matches etc etc ...  It took a little bit of head scratching but really  not difficult to do - though I think that my method is very far from optimal, but since it's just some arithmetic checking inside a grid it looks to be pretty fast - and it'll only run if the player is idle for 'x' seconds.

 

The good thing is i can now use that same script to check for no matches & then shuffle the board up :)


  • 0

Spoiler

MOD EDIT: You signature is taller than the permitted total height of 150px and has been spoilered. Please fix.


#35 Dicebag

Dicebag

    GMC Member

  • New Member
  • 3 posts
  • Version:GM:Studio

Posted 20 April 2015 - 06:01 AM

In the summary, you mention that the engine can be modified to only allow a swap if a match exists. How would one go about doing this? I've been wracking my brain and playing around in the code for a couple days, but my scripting skills are too limited, apparently. Any help would be greatly appreciated!


  • 0

#36 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 20 April 2015 - 08:07 AM

Pretty easy to do realy as much of the code already exists. The key issue in having the items swap back if there is no match is it is possible to have a level which cannot be finished so the onus is upon you to "decide" what happens if this should occur.

 

But here is the modification instructions you requested.

The script called scr_check_playfield performs the match3 in a line checking and returns the number of matches it found. This is precisely what we want however It also marks (sets a variable) in each item which matches so they can be destroyed, and we dont want this. We can therefore duplicate this script and remove the sections which set the mached variables.

 

We want to check for matches after the two items have been swapped so we can use the items End Of Path Event to check if there were any matches, forcing the two items to reverse (i.e. plot new paths back to each other).

 

All we need do therefore is call our duplicated script and have the "swapping back" code execute if the script returns zero matches and we are done.

  1. Duplicate scr_check_playfield and call it scr_check_matches.
  2. Edit it to remove the two loops that set the matched variables in the items which matched.
  3. Add a conditional in the items End of Path event to force the two paths to plot back to each other.

scr_check_matches

Spoiler

obj_items Other > End of Path event

Spoiler

And that should be it. The two selected items should swap and any matching items destroyed as normal but in neither matched they should simply swap back. Levels are created a random and with random you get "uncertainty". The onus is upon you to decide what to do should a player be unable to finish a level.

 


  • 0

#37 Dicebag

Dicebag

    GMC Member

  • New Member
  • 3 posts
  • Version:GM:Studio

Posted 20 April 2015 - 03:03 PM

Thanks for the quick reply! I've plugged in the new scripts, but it keeps crashing on line 3 of the end of path event. Any suggestions?

___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Other Event: End Of Path
for object obj_items:

Push :: Execution Error - Variable Get -1.reverse(100090, -2147483648)
 at gml_Object_obj_items_EndOfPathEvent_1 (line 3) -     if(global.clicked != id && !reverse){
############################################################################################


  • 0

#38 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 20 April 2015 - 03:41 PM

It seems to be complaining that reverse is not defined.

Make sure it is set to false in the Create Event (Did I miss that out? Sorry, my fault not yours.)


  • 0

#39 Dicebag

Dicebag

    GMC Member

  • New Member
  • 3 posts
  • Version:GM:Studio

Posted 20 April 2015 - 04:53 PM

You're right, it works like a charm now. Thanks for the help, I was worried I'd never figure that one out.


  • 0

#40 Dannyk1994

Dannyk1994

    GMC Member

  • New Member
  • 1 posts
  • Version:GM:Studio

Posted 13 June 2015 - 07:45 PM

If any of you are in need of a simple tutorial check out the video below :) 

thanks in advance :)

https://www.youtube....h?v=tR64sEMO500


  • 0

#41 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 13 June 2015 - 08:18 PM

Videos are OK (I suppos) but not as instuctive or helpful as source code with examples.


  • 1

#42 niceumbrella

niceumbrella

    GMC Member

  • New Member
  • 9 posts
  • Version:GM:Studio

Posted 21 June 2015 - 03:57 PM

First, let me just say THANK YOU for posting this.  I have spent the past couple days soaking it in and getting a feel for how things are working and its has been a huge help since I am working on my first project in GM.

 

I was hoping you could help me out with something.  I am trying to wrap my head around a modification of this game.  Basically instead of allowing ONLY a match of the same type, the game would allow some situations where other matches are acceptable.  Similar to a slot machine where 2 fruits and a 7 may net a smaller prize ( in this case score). 

 

I realize to do this I would have to eliminate the code that checks for matches when the game is generated.  I would probably need to go with a touch/drag object to actually create the matches as well, so swapping would be removed.

 

The way I was thinking this would work would be (after the previous steps):

 

-2D array of all of the objects in the playfield

-defined list of acceptable 3 (or more) in a row matches

 

 

For this to work more efficiently though, I think I would not be able to use the sprite_index function and instead would need to assign a value to each object.  

 

As a very rough example (not really how I see it working, but basic idea) say I wanted to allow the combination of 3 cherries OR 2 cherries and a strawberry, would it work to assign a value of say 2 to the cherries, and 1 to the strawberries. and say when 3 are selected/swiped over, if the value of sprite_cherry + sprite_cherry+ sprite_strawberry >= 5, then match exists.

Would that be even doable in gamemaker using modifications to this current engine?  Or would I be better off building from scratch?


  • 0

#43 Noele

Noele

    GMC Mentor

  • GMC Member
  • 4252 posts
  • Version:GM:Studio

Posted 21 June 2015 - 05:20 PM

Well the match3 "engine" uses the image_index (or sprite_index if using animated sprites) as the comparison however it could use any variable local to the items instead. When the items are created you could also assign each a specific match number - e.g. Strawberries could be assigned the same match number as say cherries. Thus cherries & Strawberries would look different yet still match if there were 3 or more in a line.

 

Does that sound like something you can use and take forward?


  • 0

#44 niceumbrella

niceumbrella

    GMC Member

  • New Member
  • 9 posts
  • Version:GM:Studio

Posted 23 June 2015 - 01:43 AM

Sorta.  Was trying to basically make a combo where 2 of one and 1 of the other would be okay, but 2 of the other and one of the 1st one would be not okay.  I found another way to do it... but it looks like I'm taking it in a different direction.

 

Thank you!


Edited by niceumbrella, 23 June 2015 - 03:18 AM.

  • 0

#45 mfpower

mfpower

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 22 September 2015 - 01:43 PM

The link  to the download says:

This Account Has Been Suspended

 

You really would help me if u can upload again somewhere!

Thanks in advance


  • 0