Столкновения двух спрайтов

  1. 10 GELLOAD "g", "icon.png"
  2. 20 SPRITEGEL "g1", "g"
  3. 30 SPRITEGEL "g2", "g"
  4. 40 SPRITEMOVE "g1", x%, y%
  5. 50 SPRITEMOVE "g2", x2%, y2%
  6. 60 w% = GELWIDTH("g") : h% = GELHEIGHT("g")
  7. 70 IF x% < x2% + w% AND x% > x2% - w% THEN a% = 1
  8. 80 IF y% < y2% + h% AND y% > y2% - h% THEN a% = 2
  9. 90 IF x% = x2% + w% AND a% = 1 THEN x% =x% + 1
  10. 91 IF x% = x2% - w% AND a% = 1 THEN x% = x% - 1
  11. 92 IF y% = y2% + h% AND a% = 2 THEN y% = y% + 1
  12. 99 IF y% = y2% - h% AND a% = 2 THEN y% = y% -  1
Код работает лутше чем spritehit

Реклама

Мы в соцсетях

tw tg yt gt