This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-06-28 13:58:18

AeroEng
Scratcher
Registered: 2011-05-21
Posts: 8

Keeping Track of How Many Degrees Rotated

Does any one know how to keep track of how many degrees rotated for a sprite?  For example, if a sprite has rotated 'x' amount of degrees, then (a) script(s) will find out the value of 'x' using the [blocks]<direction>[/blocks] block.  I need this/these script(s) for a newer and better version of my project 'http://scratch.mit.edu/projects/AeroEng/1862152,' or the  "The Original Spacecraft Simulation," so I can use it to simulate the effects of a spacecraft changing direction and then changing velocity.

Offline

 

#2 2011-06-29 01:00:44

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Keeping Track of How Many Degrees Rotated

Well, in each part of the script that rotates the object, you can have it also change a variable that tracks the rotation accordingly. For example:

Code:

When green flag clicked
Forever
    If <key right arrow pressed>
        turn right 5 degrees
        change (turned) by 5

    If <key left arrow pressed>
        turn left 5 degrees
        change (turned) by -5

http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-06-29 18:56:34

AeroEng
Scratcher
Registered: 2011-05-21
Posts: 8

Re: Keeping Track of How Many Degrees Rotated

THANK YOU, Harakou!!! It helped a lot! Darn myself for not thinking about that.  sad  Anyway, it was very helpful.  smile

Now expect a surprise...

Offline

 

Board footer