I have followed the instructions of a “TheCodingTrain” tutorial, it describes how to calculate the distance between two circles to emulate collisions. I have a lot more, but this is the code I have pertaining to my problem.
playerPos = createVector(width * 0.2, height / 2, 60);
enemyPos1 = createVector(width * 0.8, height / 2, 40);
d = dist(playerPos.x,playerPos.y,enemyPos1.x,enemyPos1.y);
circle(playerPos.x, playerPos.y, playerPos.z);
circle(enemyPos1.x, enemyPos1.y, enemyPos1.z);
if( d < playerPos.z/2 + enemyPos1.z/2){
enemyPos1.x++
}
I tried the code above, it did not make the position of the smaller circle change. I was expecting it to move. I have gone through and I haven’t identified any problems with the code.