That depends.
Right now, you check if they are in the absolute same location.
That is, if their coordinates are the same. This will rarely happen outside of grid based programs.
Other options could be:
Check if distance is less than their combined radius.
(useing pythagarus to get the distance, also, since your circles are triangles, it may give some collision where there is none)
A bounding box collision test.
(easy to implement, not so precise unless you only use squares)
Line intersection test.
(a bit harder to implement but perfect for geometric shapes as it can allow you to find any intersection perfectly)
Lastly pixel perfect collision.
(this is a trade off. It's easy enough to implement by following a tutorial, and it will give perfect results with any bitmap images, but it consumes a lot more power than most want for moat applications. Use this only of needed)
I guess there are more out there, but if you learn these and what you want to use, you are a good part of the way,and it will teach you a lot.
A bonus info, I suggest that in this code:
///// ENEMY MOVE /////
if(Triangle.getPosition().x == 0){
dx = 0.5;
}else if(Triangle.getPosition().x == 768){
dx = -0.5;
}
if(Triangle.getPosition().y == 0){
dy = 0.5;
}else if (Triangle.getPosition().y == 568){
dy = -0.5;
}
Triangle.move(dx, dy);
Instead of == you use >= and <= (greater than or equal to, and less than or equal to)
The reason is that == is absolute, so of by some means your enemy moves from say 767.5 to 768.1 it will just keep moving.
If you instead had said >= it would still change direction.
Of course, if you are 100% sure there will never be a case where this happens, than == is just fine