ScratchData LogoScratchData
Back to kriblo_test's profile

touching opposing color

KRkriblo_test•Created January 30, 2025
touching opposing color
4
3
74 views
View on Scratch

Instructions

While working on my 100 blocks Chess project (link below) I shared the original project because I couldn't get the "color () touching ()" block to work properly. This project illustrates the workaround I came up with, using as few blocks as possible. Each Chess piece clone has a sprite only variable called "color", which is either white (0xFFFFFF) or black (0x000000). This variable can be passed to the "touching color ()" block, to detect collision with pieces of the same color. To detect collision with pieces of the opposite color "abs(color-0xFFFFFF)" is passed instead. In this demo, press Space to toggle white/black. All code by me (@kriblo). See inside Chess (100 blocks): https://scratch.mit.edu/projects/1126087243/

Project Details

Project ID1127285317
CreatedJanuary 30, 2025
Last ModifiedJanuary 30, 2025
SharedJanuary 30, 2025
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root