# Multi-line slot game problem ?

Get help using Construct 2

### » Mon Jan 14, 2013 11:13 am

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)

I know Rex created the 'matcher plugin' but I was wandering if there
was formula to achieve this without using a plugin.

B
21
S
6
G
8
Posts: 1,215
Reputation: 7,889

### » Mon Jan 14, 2013 1:29 pm

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.
B
22
S
6
Posts: 32
Reputation: 2,216

### » Mon Jan 14, 2013 4:05 pm

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

and if poss, help me implement the events.

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

B
21
S
6
G
8
Posts: 1,215
Reputation: 7,889

### » Mon Jan 14, 2013 11:34 pm

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.procrastinator2013-01-14 23:36:03
B
15
S
5
G
7
Posts: 876
Reputation: 5,650