algorithm - Movement in Java games without pathfinding -


let's want have object move along set path between points a, b, , c repeatedly throughout game, based on variable. now, program in full a* pathfinding, take lot of time , require lot of code wouldn't used full worth. there easier way this? @ moment, idea have have object move set number of pixels in 1 direction, another, another, easy object several pixels off after while. should add none of points directly accessible 1 another, in object have go around walls. appreciated, feel i'm missing obvious here.

i should clarify walls not changing position. remain entire game.

define sequence of points p such that:

  • there no obstacle between 2 consecutive points p[i] , p[i + 1].

  • traveling along sequence of points take b , c.

in other words, you're taking path b c , breaking straight segments. points fixed, won't stray path due floating-point precision.

now can accomplish objective moving object point point in sequence p. move in reverse, iterate on p backward.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -