Need help on a sprite image detector

Hello,

I've been having problems in a sprite detecting image to move.

This is one of the procedure to move,

The CollidedWithOther block isn't filled because I am still searching for a block that runs through all of my sprites in a game and detects if it has this image
helpers_assets

I will greatly appreciate any tips/help :grinning_face_with_smiling_eyes: Thank you.

If you pull in a Sprite Collided event block and change it to a Generic block, you will have access to both Sprites that were involved in any collision.

You could then use the Any Sprite's Picture (Image?) block to get access to each of the 2 Sprites' pictures, and compare each to your desired picture.

Im a bit confused, Could you explain it a bit more? Thanks (I have many sprites btw and the collision with a sprite is random but that is in another block)

They are all moving randomly and will collide with a random Sprite, Then what?

No, there is just going to be 1 sprite moving, but many sprites it could collide with. My problem is that I need it to detect the picture that the 1 sprite is going to be colliding with.

make a list of all other Sprite, then use 'for each item in list ' block to detect if it is colliding with any from the list.

1 Like


This Is The procedure I updated and the list is

Something is wrong with it as it is not doing what intended

The blocks looks fine for me.
how your Sprites are located? is this some kind of maze game?

Not really a maze game.


Once the screen initializes the little sprite spawns on the purple block. You click the blocks to become tiles. The little sprite can now (randomly) walk on the tiles


This code is to make the empty sprites become a tile


And this is to make the little sprite randomly move around the UI

I think the problem would be that I didn't put all the sprites on the list. I will try to do that and see if it would work.

in this case, there is no need to detect collision.(also the app inventor collision detect is not so accurate).
you need a list to remember the state of all the tile/block. before moving, check in the list if the destination is reachable.

1 Like

I made sure of that at the start by making each tile/block 50 by 50 pixels while basically touching each other, so when the empty tile becomes a filled tile it can be joined with other filled tiles (Good tip as the placement of the tiles can change the movement of the sprite)

Here is a sample app and doc that deals with a similar issue.

I might take a look at it once I get back to my reg. computer.

Also I put all the block sprites into the list and it worked, Thank you :grinning_face_with_smiling_eyes:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.