Resources blocked in recursive function

Recursive function is correct because when the move is founded sprites are unblocked.

I didn’t assume it was wrong in the first place. I only want to know, if it blocks all the process until the recursion is completed like a loop that executes 1000000 times.

It’s really hard to find solutions without an example by the way.

recurse function found move in 1, 2, 5, 9, 12, 16, 22, 30, 60 seconds (it’s the difficulty level of game)

There is a sprite (an animate wheel for thinking) blocked during the recurse function execution.

Otherwise the game works fine :wink:

i can also remove sprite but… it’s not a good solution :slight_smile:

Download my puzzle game and tell me if that is what you are talking about with moves being blocked etc. if so then I can just send you over the code that does just that.

https://play.google.com/store/apps/details?id=the.billyblob.saga

In a nutshell you have to move blocks out of the way if they are in fact blocking the way and/or the arrow on the block is moving in a different direction then you cannot move.

But like bgm said it is really hard to help you out without some kind of example or better explanation :slight_smile:

Sorry just saw your post while i posted. :slight_smile:

If 

If all you want to do is turn off the animated wheel or check what to do when it is done couldn’t you just run a sprite finished event and check if it is still blocked if not run the animation again?

local function spriteListener( event ) if (event.phase == "ended") then if (gameStillBlocked == true) then spriteObj:play() end end end spriteObj:addEventListener( "sprite", spriteListener )

That way it “only” plays when it is checking for moves.

Thx Christopher but i have already try this solution and no change :frowning:

Well… i remove the sprite lol

If you are using an image sheet or have the sprite loaded and hidden “as a temp image” then if you add/remove it should already be in memory and you wont take the load hit.

Your game probably has too many moves, and that freezes the game since you are searching through every single move IN A SINGLE FRAME - which is what a recursive function does. 

If that’s the case, you should  think of structuring your game moves differently, for efficient lookup. 
A binary search tree perhaps?