Help with code! Angles


#1

I need help, it might sound bad but I can’t figure out the angle that would go to the top right of you added a move forward to it, anyone know xD?


#2

We’re is the thing placed?


#3

Also there’s a project on my account called zero finder that might help


#4

Here I don’t know, I can’t find the problem but I’ll post my project and I’ll see if y’all see a problem, it’s my first real project in months so don’t judge.

So basically I’m trying to make it come back and bounce off the walls, for the most part, it works but there’s a few spots that mess up, if it doesn’t work for you the first time just keep resetting until it does, the ball does go that far after you hit it with the platform just so I can test it right now


#5

Some times it gets stuck in the corners and sometimes when it hits the top of your phone, it goes to a side rather than coming down, the numbers are the angle of the ball being detected.
I think one problem is, it’s still moving forward even when the angle is changed so it’s not updating. If anyone can find a solution please tell me @POMTL thanks :smiley:


#6

And that is we’re I can no longer help for I no longer have hopscotch


#7

Lol why t you in the forums xD


#8

@CreationsOfaNoob if your in could ya help me? The code is extremely simple so you shouldn’t have a crazy hard time figuring it out if you read it for a second.


#9

Because I can


#11

So you are trying to make the ball bounce off the walls?


#12

Yea, but i dont know why they won’t rip


#13

I think taking the angle * -1 should work. Try that.


#14

Which one? I don’t know what one I need to do thst too


#15

The object that bumps the wall. I might also not work at all.


#16

There 4 controllers, a left and right bump off the edges below 180 Y and 2 controllers abover 180 Y, the ones below 180 keep the bounce up, if it hits above 180 Y the bounce takes it down. I can’t fogure out an idea to stop the moving forward tho, I feel like that’s what not making the angle of the ball update after hitting a wall. If that gets fixed then no matter what, the ball will change directions after hitting a wall but if you look at the angle distinguisher, it dosent always change after hitting a wall, I can’t figure out why.


#17

you have tagged me over 3 times today. chill


#20

I have a pretty simple method to have a ball bounce off the walls. You are free to use it if you’d like

Check the code in this project:

This is the bit you’d need. Set an angle for the ball & set it to move forward. The formulas in the ‘When self is touching Edge’ are all that’s needed to bounce off the 4 screen edges


#21

Assuming that you didn’t change the angle or flip beforehand.
Top right: 45°
Decrease to go closer to the right, increase to go further left, just keep it less than 90° and more than 0°.

I use angles a lot in trail art. Here’s the basic rule of thumb I use.
Every object before adding any other code like angles or flip starts off facing right, parallel to the screen.
Positive turn numbers bring it upwards/counterclockwise and negative numbers bring it down/clockwise.