Point towards touch location

#1

Hi, I think this is where I’m supposed to put my stuff. Okay, so, I want to know how to make stuff point to wherever someone touched something. For example, I want to make a heart point towards my touch location. Does anyone know how to do that? Thanks.

#2

This code isn’t made by me, but it seems like you are free to use it in your project:

#3

That’s an interesting project, but overly complicated. The simplest method, using inverse tangent, needs only one Check If & 2 Set Angle blocks.

This post shows & explains the code:

In the linked code, the hand is points towards the dot. Just replace the dot object x & y positions with Last Touch x & y positions…

————
Edit: Also, to make a heart “point” (I assume you want the bottom pointing towards the touched spot), Add 90 to the calculated angle

#4

I remember one day at school I was thinking about a point to block, and then I was like, wait, I could use arctan! So I did it, but as soon as I was done, I thought, “someone else probably already did this”, so I looked up “point towards using arctan”, and there was your project!

#5

That project is more than one year old, so I don’t know if inverse tangent was around at that time (or at least not used that much). Your method is obviously better and I was about to search for one of your codes on the forum and/or on the app.

#6

It’s really impressive that Hops figured out how to create point towards code before tangent was available!

#7

Yes, indeed. If I’m not wrong, @MagmaPOP did the same thing when tangent wasn’t around. I looked for the project on Hopscotch, but I couldn’t find it, unfortunately.

#8

Hmmm. Idk. Maybe trigger something with x and y? Obviously, it’s a lot easier to do on Tynker.

#9

@PeppermintosFox
Hi
Yep just wanted to say hi

#10

hi sorry this is 2 wks late