Hello, I want to make a casual 2d game with sokobn and match 3 elements. Basiclly, the player could push boxes with 4 different colours, and box would be eleminated when match 3 boxes with same colour. Now i am planning the bueprint work. The hardest part for me is match 3, Q1:how to let the system knows that “it’s time to swipe”? Q2: how to tell system which 3 boxes need to be destroy or compare? Q3:how to compare boxes with different colour so system knows if they are in 1 colour or not?
Follow some tutorials. See how to handle variables and arrays in blueprints.
as for your problem:
Make box blueprint, which knows its own color. Set its color variable at construction time.
Let player push it (box should be physics actor that can be pushed by player pawn)
Make a bit bigger overlap box around pushable box.
Then check overlap event for pushed box, ie one that overlaps with player pushing. Check only that one because only that one is moving.
If that box overlaps 2 or more boxes, ask those overlapping what is their color (read their color variable).
if you have 2 or more of same color, do swipe
PS. do not know what swipe event is, hope i guessed right.
PPS. if you want bit less chaotic pushing movment, you can add physics constrains to boxes, and set their values to limit movement to planar only, or even linear only and update constrain values in runtime.
thx man, very helpful for me.