ImageSprite. Enable cannot be disabled

I wanted to disable a repeat selection of an ImageSprite after the ImageSprite.Picture is selected (set) on a canvas. But this did not work. What could be the reason?

Maybe you needed instead a separate Sprite Touched event for each Sprite?

Use those instead of the Canvas Touched event.

I added a separate Sprite Touched event and set the ImageSprite Enable to false for each ImageSprite. Didn't work. :sweat_smile:

This looks like a three by three grid.

Are you coding tic tac toe?

Buttons in nested horizontal and vertical arrangements would be easier.

If you want a better analysis,

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
export_and_upload_aia

Also

(Canned Reply: ABG - Download those blocks and post them here)

Screen scraped blocks lose resolution and become unreadable.

AI2 generated block images are SVG, which are readable under magnification.

Please download and post each of those event block(s)/procedures here ...

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See

for how to download individual draggable block images.

p.s. maybe you forgot to increase the turn number?

I think your issue is the nested conditions inside if..else blocks. There are too many nested if..else going on. Perhaps debug carefully. Hard to say from the screenshot alone you posted.

playTic_Tac_Toe.aia (4.3 MB)

The correct blocks image for the tic_tac_toe
!

Your png file sizes are all over the place, as is your Sprite locations and sizes.

Switch to Button backgraounds, with Fill Parent sizing.

Also, you never change Player turn from 1.
Don't you want to give player 2 a chance to play?

Yes, player2 has his turns too :grinning:

Drop the Canvas Touched event, and use this:


playTic_Tac_Toe.aia (4.3 MB)

It replaces all the Sprite Touched events.

This clears up the repeat click problem, disabling sprites after they were clicked.

The global game step management needs work.

Thanks ABG.
But I'm still curious why the ImageSprite.Enable doesn't work for my case.

Because you were catching Canvas Touched events, and not responding to sprite touches.