Hi there,
I currently have a project where we need to make a automatic obstacle avoiding robot. With the project we need to make it possible for the user to interfere, and control it for a bit in case the robot can't solve it's own problem.
Because of the succes last project with MIT APP INVENTOR and because i really enjoyed it, i wanted to make an app again for the robot. With that I didn't want a standard up, down, right and left button, but instead make it a little more difficult, so i decided to implement a joystick in the project. I've watched a couple video's on how to make an easy one with the canvas and the ball components, so i made this.
I've made 2 balls just to make the joystick look better and the center of the second moves with the drag of the top one so it moves along with it. I've made a block with it where i first of all do - 150 for x and y to make the coördinates like a normal joystick and to do the math to make my joystick stay in a circle, like this.
With that i want to program it so if i move my finger outside the circle it stays in it.
At last I of course set the coördinate back to app inventors canvas by +150 on the x and y again.
My problem is that i'm not able to make the joystick stick inside the circle, so i wonder if anyone could help me.
Hope i explained my problem good enough, otherwise let me know.
greetings,
Brum