Genesys Generation
Member
There are 2 cars (same object) that go through a circuit:
Consider that the white part is an intention that they avoid (it would be as if it were a wall). The black part (circuit) would be just illustrative, it is not an object.
In the program the room looks like this:
The walls are avoided as follows:
In addition to the walls, I would like cars to avoid each other. I did it as follows:
It happens more or less like this:
Cars avoid the starting position of other cars, but I would like you to avoid the current position of other cars. For that, I put this part of the code in the step event:
I tried some changes, with some conditions, but none worked. Simply buggy, cars even go through walls (something that shouldn't happen, because I don't even change anything in them).
Documentation:
https://manual-en.yoyogames.com/#t=...m&rhsearch=mp_grid_path&rhhlterm=mp_grid_path
Consider that the white part is an intention that they avoid (it would be as if it were a wall). The black part (circuit) would be just illustrative, it is not an object.
In the program the room looks like this:
- Green -> background
- Red square -> car
- Other light colored squares -> points that are followed by the cars (to go through the circuit)
- Black square -> wall
The walls are avoided as follows:
GML:
mp_grid_add_instances(grid,obj_Wall,false);
Code:
repeat(instance_number(obj_Car)){
i++;
if(instance_find(obj_Car,i-1).id!=id){
carOtherID=instance_find(obj_Car,i-1).id;
mp_grid_add_instances(grid,carOtherID,false);
}
}
Cars avoid the starting position of other cars, but I would like you to avoid the current position of other cars. For that, I put this part of the code in the step event:
Code:
mp_grid_add_instances(grid,carOtherID,false);
Documentation:
https://manual-en.yoyogames.com/#t=...m&rhsearch=mp_grid_path&rhhlterm=mp_grid_path