Hey guys,
I am trying to develop a random movement algorithm which will do the following:
The object spawns at a random location object.loc.x and objectloc.y and starts moving randomly pixel by pixel in a random direction. However, if it hits a boundary it should not go out of bounds.
for example, if (object.loc.x || object.loc.y == framebound) change direction
I made something based on this kind of if statements but is limited to triangular movements
Thanks for any resources or ideas.
I am trying to develop a random movement algorithm which will do the following:
The object spawns at a random location object.loc.x and objectloc.y and starts moving randomly pixel by pixel in a random direction. However, if it hits a boundary it should not go out of bounds.
for example, if (object.loc.x || object.loc.y == framebound) change direction
I made something based on this kind of if statements but is limited to triangular movements
Thanks for any resources or ideas.