I know one of the events is if you have the mouse hover over the element, but as far as I know, there’s no event for when the turtle is in the same position as an element.
Basically you’re looking to do “collision detection”, something not built into App Lab. There’s been a few posts about it in the past. Looks like there might be a way that requires a bit more coding:
Hi,
I am attempting to set up collision detection in a maze environment so that a ball can pass through the maze and properly collide with the walls… many of my students are interested in this sort of thing so I have been trying to get it to work myself… Here is a link to the code: https://studio.code.org/projects/applab/mV1iXG1eshIZtb27dHT9Xw any thoughts?
I know game lab has built in collision detection, but many of my students are uncomfortable changing platforms when it comes to preparing…
Will Code.org implement a collision detector for CSP’s App Lab? I have a lot of students wanting to incorporate this into their Create Task but are having difficulty implementing. Doug McNally has made a great tutorial video, found here but I am also teaching CS Discoveries and coincidentally we are on Unit 3 Stage 12 (Collision Detection). For this section, it’s very intuitive and easy to detect collisions, but in App Lab, it’s no longer easy. Is there a reason for this I’m completely missing?
…
Hey Katie,
Currently App Lab doesn’t easily support this kind of interaction. There’s no command like turtleIsTounching(color) which a student could use within an if-statement to prevent a turtle from moving through walls, change the score, etc. There are ways you could do this by manually performing collision detection (i.e. keeping track of the locations of all walls and the turtle and comparing to make sure the turtle isn’t touching one), but depending on the programming ability of the stude…