So I started out both sprites in the top left corner.
The sprite then moves 1 pixel to the right and records how many pixels it moves (variable canvasHeight and canvasWidth) until it hits the edge (That is what the while loop does, it stops doing this in the collides with edge event.)
While loops keep working until the statement changes (which happens when an edge is hit)
I did the same for the height.
For testing purposes, I spit the values on the label to see if it works.
In the test screen, the canvas height is 380 and the width is 227. I’m going to use those values to move the mushroom around the canvas randomly.
Looks like it works because I get different values on my iPhone screen.