Re: is it possible for a sprite to detect is its touching a color?

675 views
Skip to first unread message

Enis

unread,
Oct 29, 2014, 9:35:53 PM10/29/14
to
Maybe... You'd have to check every pixel for it's color, and no matter how hard you try, that'll be very consumptive in AI...

You'd have to analyze the color of each pixel based upon it's location... Use the Canvas.GetBackgroundPixelColor, and pass it the x,y of each tick, but expect the deal to be VERY slow...

Abraham Getzler

unread,
Oct 30, 2014, 10:09:50 AM10/30/14
to mitappinv...@googlegroups.com

Enis

unread,
Oct 30, 2014, 10:42:25 AM10/30/14
to mitappinv...@googlegroups.com
Please not that Scott's example is an AI Classic project... you'll have to convert it to AI2...

Enis

unread,
Oct 30, 2014, 8:35:36 PM10/30/14
to
You appear to have different timers for different stuff... That's NOT the way you should do this.  You need to check that color every time you move the sprite, which I'm sure, is in another timer.... Do this in there... When the sprite moves, check the color.

Also, why open another screen when the game is over?  Just put up a Notifier... you can also change the image in the background of the same screen...

Taifun

unread,
Oct 30, 2014, 8:43:22 PM10/30/14
to mitappinv...@googlegroups.com
what is the timer interval of your clock?
what happens, if you set the ball manually to a x/y coordinate with the light blue background?
use Do it to debug your blocks
Taifun

SteveJG

unread,
Oct 30, 2014, 9:12:10 PM10/30/14
to mitappinv...@googlegroups.com

Enis

unread,
Oct 30, 2014, 9:27:15 PM10/30/14
to mitappinv...@googlegroups.com
Post a screenshot of how and where you're moving the ball...
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages