How do you change angle direction, movement but not the actual angle of an object?


So, I want the object to move at 20 degrees, but I don’t want the object to be at an angle of 20 degrees. I want it’s angle at 0, but moving in a 20 degree angle - how?



As I don’t code with Hopscotch anymore, I can only give some simple solution.
Have your Sprite forever set position to a Sprite(dot)
Then move the dot at 20 degree angle

I’m sure @ThinBuffalo knows a way to do this using Cos/Sine and even polar coordinates


The thing is, the sprite is an actual object, not a dot.


I mean set your objects position to the dot.
Make the dot invisible.


I think there is a better way than that, I am trying not to add extra objects.

I think this is possible with sine and cosine, don’t know how though.


I like the simplicity of @Stradyvarious’ way. But to avoid adding extra objects:

Introduce an object variable named MoveAngle

When 7=7
    Set Angle = (self) MoveAngle - 30

(Or whatever value instead of 30 makes the object face “foreword”)

You can still use the native Speed trait to avoid adding a new variable. To make our code work the similarly to Move Forward, we just need to know that the distance moved per frame is Speed/40 (this was worked out through testing). So a speed a 40 would move at 1 pixel per frame, while a speed of 400 would move at 10 pixels per frame. We can also use the Speed variable to control when the object moves by setting Speed to 0 when we want it to stop.

When Speed ≠ 0
    Set Position X: (Speed/40)*Cos(MoveAngle) + X position Y: (Speed/40)*Sin(MoveAngle) + Y position

And of course instead of using the red Set Angle block, you’d use the yellow Set MoveAngle = [some angle]

I published a WIP (work in process) project a while back that uses this technique since the plane emoji is at an 45 deg angle:


This seems a little bit tricky. But try @ThinBuffalo’s solution!


I think I have done something similar to this…but I needed two objects… I had one object move in the angle while the other one was repeatedly setting its position to the first…


Never tried but i guess the trig way would probably use a set position anyway but idk if that would work.


So you want it to be angled but look like it still is at 0 degrees?


Not expert,but trying to help.
Your sprite can have a clone,which would be visible and the original object is invisible. I think try setting invisibility to 99%. The original would have a different angle and the clone will have a different angle. I think this is how you would do it
When game starts
Create a clone
(Make a new object value called rotation)
Set (original object)rotation to (your angle)
When object is cloned
Set (clone)rotation to 0
Hope this helps.


Sometimes pushing yourself unnecessarily too hard does nothing but makes you disinterested in the subject.


Wait ur back…after all that


I worked myself excessively to hard, and consequently, have no interest in coding.


So you went from no chatting just coding, and then from no coding to…reading books?


Reading books and doing plenty of other things.
Since 2017 I never really had that compelling ardour to code, and learn java or whatever it’s called.
I guess I pretended to be an advanced coder


Well you were definitely pretty advanced in Hopscotch