[Solved]get number of in stances in an area along the same Y but across two X values

S

Slothagami

Guest
Hey Everyone, so i went in WAAAAAAAAAAAAAAAAY over my head with this water physics calculations stuff, i need to find the number of water instances in an area (in the same y because they are in a grid) from the edges witch are set as LeftX and RightX, this is the last part of the equation that i need to make the water work and its just as difficult as the rest as i have never attemptedanything like this before.
Image.png
here is the attempt i have made, if it helps
Code:
var Count, PreviousInstance, CurrentInstance;
Count = 0;
PreviousInstance = noone;

for(i = 0; i > WidthOfContainer; i++){
    CurrentInstance = instance_place(LeftX + i, y, oWater);

    if(CurrentInstance != noone and CurrentInstance != PreviousInstance){
        PreviousInstance = CurrentInstance;
        Count++;
    }
}
var FinalCount;
FinalCount = Count;
thanks in advance!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Just use "collision_line_list" along the line of instances and then use "ds_list_size" to find out how many are in the list. :)
 
Top