Столкновения двух спрайтов
- 10 GELLOAD "g", "icon.png"
- 20 SPRITEGEL "g1", "g"
- 30 SPRITEGEL "g2", "g"
- 40 SPRITEMOVE "g1", x%, y%
- 50 SPRITEMOVE "g2", x2%, y2%
- 60 w% = GELWIDTH("g") : h% = GELHEIGHT("g")
- 70 IF x% < x2% + w% AND x% > x2% - w% THEN a% = 1
- 80 IF y% < y2% + h% AND y% > y2% - h% THEN a% = 2
- 90 IF x% = x2% + w% AND a% = 1 THEN x% =x% + 1
- 91 IF x% = x2% - w% AND a% = 1 THEN x% = x% - 1
- 92 IF y% = y2% + h% AND a% = 2 THEN y% = y% + 1
- 99 IF y% = y2% - h% AND a% = 2 THEN y% = y% - 1
Код работает лутше чем spritehit