Posted: 26th Mar 2021 15:28
Hi all, I seem to be having a problem with playing cards flashing on the screen in my latest game as though they are staying resident in memory. When I start a game the cards are tweened back to the deck but then there is a brief flash on the screen of where the cards are going to be tweened to. Has anyone any suggestions on how to fix this?

Note: it doesn't do this on every deal it seems to be intermittent.
Posted: 26th Mar 2021 19:25
That has got to be in your code somewhere.
I would go through your code and Log( szMessage ) everytime you sync() make the message so you can identify where it is. I'm pretty sure you'll find there is an errant piece of code in there somewhere
I think you need to run with debug for log to work
Posted: 26th Mar 2021 20:10
Ok thanks for the advice I will give it a try. Oddly It only seems to do it on windows, I've never seem it on android and they both use the same code. I use the same code on my Klondike game and I've never seen the error on that either. Very strange.
Posted: 26th Mar 2021 21:06
as though they are staying resident in memory

not 100% sure what you mean but making sure that you see that the "brief flash" cards are the "new" deck (not old that might somehow stay "resident").
Posted: 26th Mar 2021 21:13
Hi sorry, at first a thought it was the old cards but after watching the video a few times I realised it was the new deck that was flashing up and amended my post but forgot to remove the comment about the memory.

The brief flash is the position that cards will go to when the tween has completed.

I have one tween to move the cards to the deck and one tween to move the cards to the tableau. The brief flash is the tween destination point so I'm not sure how it can do this. I've played hundreds of games on my phone and haven't seen the issue. It only appears on windows every now and again.
Posted: 27th Mar 2021 1:43
Maybe try this.
Every frame hit test the position of the top card in the first row.
If the sprite is one of the cards AND visible (And it shouldn't be) the execute a break.

Something like;
+ Code Snippet
id = GetSpriteHit(x, y)
if GetSpriteCard(id)  // Determines if the sprite is a card
    if GetSpriteVisible(id) 
         if GetSpriteSHouldbeInvisible(id) // Checks that the sprite should be visible/invisible at this time
                 id = id
         endif
    endif
endif


The run the app with debug and set a beak on the line: id = id
Posted: 27th Mar 2021 8:15
Thanks Blink0k, I'll give it a try later today.
Posted: 27th Mar 2021 9:29
I would log the tweentime and x,y position of the sprites, as I think the tween must be responsible for that behaviour.
Sync() is like a tank, no matter what it will be executed each loop if not told otherwise.
There is aswell no hidden buffer that may save any rendering information for more than one frame (the swap buffer can't do such jumps)

I suspect a float value going above a certain treshhold like
+ Code Snippet
stuffset(v#) // where v# can't be > 1.0
if v#>1.0 then stuffend() 


but v# can't be more than 1.0 or everything will be moved to 0.0 tween

Such a construction is able to trigger such a rendering error.
Posted: 27th Mar 2021 11:19
I think I have found the issue. A tween returns the cards to the deck which then triggers the deal tween it looks like sometimes the deal tween was being triggered fractionally before the return tween had completed. I've put a small delay in between the two tweens and it hasn't had the issue since. Hopefully it is fixed now.