Collisions
in
Programming Questions
•
10 months ago
We have a Santa code that starts at an X coordinate of 185. Each time you press an arrow key, you move 31 steps in that direction. We tried this code:
if (santaX==x{
background(250);
}
However, the background flickered at random moments, and was not what we expected it to do. We are looking for a simple way to sense the touching of these two objects. We are not dealing with shapes, we are dealing with imported images. Here is the reindeer code:
image(reindeer, (x), 273, reindeer.width/2, reindeer.height/2);
x = x + 2;
if ((x > 200) && (startR2 == 0)){
startR2 = 1;
}
if (x > 450){
x = 0;
}
We need a simple way to detect collisions. Thank you.
1