Discuss Scratch

laya1952
New to Scratch
3 posts

Help: trying to make a sprite turn 45 degrees then walk around a box then return to its origanal position

I need help making my sprite walk around a box. I need to use the sensing blocks also.
mstone326
Scratcher
1000+ posts

Help: trying to make a sprite turn 45 degrees then walk around a box then return to its origanal position

We will need more information of what the issue is before we can help. Can you share what you have already started and we can look.

High School Athletic Director / Middle School Tech Teacher / High School Baseball Coach
Kung Fu by Nintendo 1984 - https://scratch.mit.edu/projects/369994801/
Taco Defense - Speed Typing - https://scratch.mit.edu/projects/316795450/
Halloween Boss Battle - Taking Back our Woods - https://scratch.mit.edu/projects/257155118/
Almost Pong - https://scratch.mit.edu/projects/656276979/
Studio - My Best Projects - https://scratch.mit.edu/studios/4125978/
Forum Help Project Examples - https://scratch.mit.edu/studios/4133335
laya1952
New to Scratch
3 posts

Help: trying to make a sprite turn 45 degrees then walk around a box then return to its origanal position

This is all my professor told us : Program a spider inside a rectangle that, starting moving up and right at 45 degrees, will follow the walls without touching them.
deck26
Scratcher
1000+ posts

Help: trying to make a sprite turn 45 degrees then walk around a box then return to its origanal position

So this is school/college work and you shouldn't expect any help to be too detailed or we're doing your work for you.

So think about what's required.

Starting the move at 45 degrees is simple enough but how will you detect touching the rectangle? Perhaps one of the touching blocks would help.

Using some sort of sensors or different costumes to detect how you've touched might be useful - have you touched a horizontal or vertical edge or even both? Once you know that you can undo the last move and you know you can safely move in one direction. Eg if you touched a horizontal side you want to move parallel to that side. If you touched both you need to move away from that corner, moving parallel to one side.

Once you're moving you keep going until you hit another side.

At some point you need to work out if you're inside or outside the rectangle.

Returning to the start could be matter of waiting until you're close to where you first hit the rectangle (store the coordinates) but you don't need to check until you've turned 4 times.

laya1952
New to Scratch
3 posts

Help: trying to make a sprite turn 45 degrees then walk around a box then return to its origanal position

I am not sure how to piece it all together. I have no background in coding. This is a orientation class. I was wondering if you could go more in depth with what exact blocks I should use. As a whole class we all struggle with the assignments that he has given. I understanding not doing the work for me, I just need more help and a shove in the right direction. I just have no idea what to do and how to use all the blocks.

Last edited by laya1952 (June 24, 2018 18:22:17)

deck26
Scratcher
1000+ posts

Help: trying to make a sprite turn 45 degrees then walk around a box then return to its origanal position

So you need the Motion blocks for movement but you can't just point in direction 45 degrees and move multiple steps, you need to move in a loop (eg repeat until) until you're touching the rectangle (Sensing blocks). Then you do much the same again really - repeat moving until touching. So you're not using a large range of blocks.

If you don't understand the basics try one or two of the tutorials in the Tips section.

Powered by DjangoBB