• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

ai tank bot

C

charles hacker

Guest
hey guys, looking for a way, already using collision lines, to detect collision lines from all possible points in the room and return the closest true point so you can then move there.

how exactly can i do that?
 
S

Selva

Guest
Perhaps I am inexperienced. But I do not know what you are asking. Could you please rephrase that?
 
C

charles hacker

Guest
cool, but in addition i want to calculate all possible collision lines on the room from every point, is there a way to do that?
 

Bingdom

Googledom
If I understand correctly, this would be incredibly slow.
Something in the lines of:
Code:
dir=0;
len=128;
repeat(360) {
  _x = x+lengthdir_x(len,dir);
  _y = y+lengthdir_y(len,dir);
  collision_line(x,y,_x,_y
  dir++;
}
?

If you want pathfinding, look at mp_ functions
 
C

charles hacker

Guest
sorry, i don't understand this code or how to use it can you explain?
 

Perseus

Not Medusa
Forum Staff
Moderator
I'm having a hard time trying to understand what your question is. Could you please rephrase that in detail?

Judging from your "all possible collision lines on the room from every point" comment; if you want to get the distance from each instance, you need a simple with construction.
Code:
with (object) {
    ds_list_add(other.my_list, id, point_distance(other.x, other.y, x, y));
}
The above code will populate a list with instance ids at even indexes (n; 0, 2, 4, ...) and their respective distances from the caller of this code at odd indexes (n+1; 1, 3, 5, ...).
 
Top