![]() |
| TI99 Environment |
| Syntax |
| integer-variable = CALL_COINCXY(sprite1,y,x,tolerance) |
| Description |
|
The COINCXY function checks for collision (COINCidence) between sprite1 AND position dot-row (y), dot-column (x). tolerance indicates the distance in pixels between the sprite and the position where they will report a collision. A collision occurs when the upper left-hand corner of the sprite and the position are within the value specified by tolerance. The value returned by the function is -1 if there is a collision and 0 if there is no collision Valid Function Values: sprite1 = an integer between 1 and maxsprites indicating the sprite number of the sprite being checked for collision. y = an integer between 1 and 256 indicating the y coordinate being checked. x = an integer between 1 and 256 indicating the x coordinate being checked. tolerance = an integer indicating the distance in pixels between the sprite and the x,y coordinate that will report a collision. Return values: integer-variable: Returns 0 when there is no sprite collision or -1 when there is a collision between sprite1 and the x,y coordinates. |
| Example Code |
` Call_CoincXY function Test
repeat : tolerance$ = ti_input("Tolerance:") : tolerance = val(tolerance$) : until tolerance >= 0
x1 = 180 : y1 = 96 : x2 = 100 : y2 = 96 : sprvel = 20
call_sprite(2,65,14,y2,x2,0,0)
call_sprite(1,65,16,y1,x1,0,sprvel)
do
coinc = CALL_COINCXY(1,y2,x2,tolerance)
if coinc = -1
ti_printat(1,10,"COINCXY:"+str$(coinc))
call_motion(1,0,0)
call_clear()
repeat : tolerance$ = ti_input("Tolerance:") : tolerance = val(tolerance$) : until tolerance >= 0
call_sprite(1,65,16,y1,x1,0,sprvel)
endif
ti_sync()
loop
| Go back to ... |
| TI99E Commands Menu |
| Main Menu |
Copyright © Carlos Santiago Lebron - TI99 Environment 2020
![]() |