# Multi-line slot game problem ?

0 favourites
• 4 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
• Multi-line slot game problem ?

I have a Slot machine with 5 reels and 3 rows.

Each symbol/sprite has a unique variable assigned to it.

The player wins if he/she gets a horizontal line of the same symbols.

I want to add a 'multi line' winning capability..So basically the player wins even if the 5 matching symbols appear on different rows.

(see pic)

<img src="https://dl.dropbox.com/u/22173473/15LINECHECK.png" border="0" />

I know Rex created the 'matcher plugin' but I was wandering if there

was formula to achieve this without using a plugin.

• There are a lot of ways that you could do this. You would be best off implementing whatever method/formula is most intuitive to you, or whatever fits in easiest with your program. But here's how I would do it:

1. Apply the reel variables to a 5x3 array

2. Make a recursive function that takes the variable present at [x,y], and checks whether the same variable is present at [x+1,y] (i.e. the reel square directly to the right). If y>0, then check whether the variable is present at [x+1,y-1] (the reel to the above-right). If y<2, then check whether the variable is present at [x+1,y+1] (the reel to the below-right). If the variable is present in any of these position, then call the same function for that position. If x+1 == 5, then congratulations - you've got a line - do whatever it is that you need and don't call the function again.

3. Call the function for [0,0], [0,1], and [0,2].

If you hate the idea of using recursive functions, then I suppose you can do a similar implementation with one or two for/while loops.

• SketchyLogic,

Your solution sounds logical, but i,m a bit sketchy when it comes

to using arrays and functions (sorry..bad pun)

Im gonna be cheeky and ask you to look at the capx file I have uploaded

here-

capx

<img src="https://dl.dropbox.com/u/22173473/reelsplash.png" border="0">

and if poss, help me implement the events.

If your too busy...then I understand and maybe somebody else might

have a look.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Yeah arrays are your best bet. I've done slots prototypes in other languages, but never in C2. I'll have a bash if I get the chance as it's something I need to get going for myself anyway.

Also, don't blur each image. It looks way better to take an actual full reel and blur that. Then when spinning is started, just place it at random positions up and down the reel. You'll need an overlay to hide the "unseen" part though. I'll knock up an example if you don't understand what I mean.

• 4 posts