Posted: 12th Apr 2021 3:55
I'm trying to make a game where if my red character touches any green color anywhere in the game, the game ends. Thus, how do I make it so that colors respond to other colors in my game? Is there are color detection command?
Posted: 12th Apr 2021 11:27
You could try this grand hack:
how to know the color of a point
Posted: 12th Apr 2021 19:09
AGK has no concept of what a red and green sprite are, you need to define it and use one of many functions designed for contact/collision checking

Look at: GetSpriteInBox()

or use collision checking functions (see help file)

or use something like this
+ Code Snippet
Type tRect
	x1 as float
	y1 as float
	x2 as float
	y2 as float
EndType
Type tPoint
	x as float
	y as float
EndType

// is the tPoint inside the tRect
Function IsPointInRect(pt as tPoint, rect as tRect)
	result as integer : result = 0
	if pt.x>rect.x1 and pt.x<rect.x1+rect.x2 and pt.y>rect.y1 and pt.y<rect.y1+rect.y2
		result=1
	endif
EndFunction result


there are many ways to know when a sprite touches another sprite, using colors/memblocks is advanced stuff and have zero benefit over using native functions.