python - How can I use a diagonal line as a boundary? -


maybe i'm having brainfart, seems should simple. i've drawn line in python using pygame:

pygame.draw.line(screen, color, e.start, e.stop, 3) 

this draws line on object screen in color color, tuple coordinates e.start tuple coordinates e.stop.

anyway, i'm trying create game stops object when hits part of line. had few ideas, of them computationally expensive. there simple straightforward way solve problem, or should make processor grunt?

oh duh! equation of line. y=mx+b can derived 2 points. goodness. can use size of object want stop on line check it's hitting line.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -