# Collision detection based on color

**URL:** <https://forum.kirupa.com/t/collision-detection-based-on-color/277533>\
**Category:** programming\
**Created:** [December 13, 2008, 5:24am UTC](https://forum.kirupa.com/t/collision-detection-based-on-color/277533 "2008-12-13T05:24:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skribble](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Skribble](https://forum.kirupa.com/u/Skribble)\
**Post date:** [December 13, 2008, 5:24am UTC](https://forum.kirupa.com/t/collision-detection-based-on-color/277533/1 "2008-12-13T05:24:36Z")

</div>

So I was thinking of ways to easily implement different terrain collision detection in my little beat’emup style engine, and I came up with a vague idea about color coding the movieclip that represents the “ground” so that I could check the value of a certain pixel and depending on what color it was, I could get my hero to swim/slow down/whatever.

I don’t see why it wouldn’t work, but the only problem is I have no idea how return the pixels color value.

Any ideas?
