I have 3 slots and each slot has 9 graphic symbols.

I can put 9 symbols in CCSPrite on a lineup and make up go down but How to do the wrap around in Coco2d?

Looking for ideas or example for Coco2d SlotMchine Logic

0.0
0

I have 3 slots and each slot has 9 graphic symbols.

I can put 9 symbols in CCSPrite on a lineup and make up go down but How to do the wrap around in Coco2d?

do you mean that those 9 graphic symbols forms a circle, that can spin forever?

just take the last sprite, then reposition it so its at the top?

In addition to what Hao Wu suggested…

Depending on what your graphics, the worst case is that you need to make your graphics of the roller and duplicate it, so its 2 x the height (assuming movement is vertical). Then if you rotation position > the original size (of one barrel rotation), you just set the Y position to Y - (height of one barrel)

e.g. if your symbols on the barrel are A B C D E etc you make your graphic

A

B

C

D

E

A

B

C

D

E

Then at any time you only display a portion of your barrel (masked)

e.g.

D

E

A

However Hao Wu’s suggestion is probably more efficient, but making the graphic 2 x as tall is probably quicker to program etc