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

#1 2009-07-26 15:23:08

waffleking09
Scratcher
Registered: 2009-07-18
Posts: 4

Problems with rotation!

Hi all,

I'm making a game where you use the left and right keys to move. However... I would like to know how to make it tilt slightly towards the direction that it is heading (left or right), then make it return to upright position when the key is release. I think this needs to be done with variables, but I'm new to variables so would appreciate any help.

Thanks in advance!

Offline

 

#2 2009-07-27 13:58:49

thelasthorizon
Scratcher
Registered: 2008-08-19
Posts: 100+

Re: Problems with rotation!

To do say <if><key[ right ]pressed?> <point in direction( 15)>
<if><<  <not>  >><<  <and>  >><key[ left ]pressed?><key[ right ]pressed?><point in direction( 0)

Offline

 

#3 2009-07-27 14:00:25

thelasthorizon
Scratcher
Registered: 2008-08-19
Posts: 100+

Re: Problems with rotation!

basically if <if right key pressed>
                   point in direction 15

                  <if not key left and key right pressed>
                       point in direction 0
                     <if key left pressed>
                           point in direction -15

Offline

 

#4 2009-07-27 14:55:57

FantasyTales
Scratcher
Registered: 2008-06-02
Posts: 1000+

Re: Problems with rotation!

it would actually be
forever
if not key right arrow pressed OR key left arrow pressed
point in direction 0
if key right arrow pressed point in direction 15
if key left arrow pressed point in direction -15
remember to use or not and and to put it in a forever block


http://ageofthefuture.ismywebsite.com/images/dg_sig_2_small.png
http://images.myadoptables.com/adopted/2340.pnghttp://images.myadoptables.com/adopted/2339.png

Offline

 

#5 2009-07-27 16:44:57

waffleking09
Scratcher
Registered: 2009-07-18
Posts: 4

Re: Problems with rotation!

Thanks for all the help, but there is one problem. When you hold down the key, it turns on an angle, and when you let go it retuns to upright position. But when you do hold down the key, the sprite sort of 'flickers' between the 2 positions. Any ideas...?

Offline

 

Board footer