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

#1 2012-01-17 09:17:35

birv2
Scratcher
Registered: 2008-05-15
Posts: 4

Keeping sprites from flipping when bouncing off the edge

Is there a way to do this BESIDES clicking on the "only face left-right" button at the top?

My class is making games, and I want the games to be as self-contained as possible, ie: the user should not have to know to click on that button to fix the problem.

Thanks in advance!
Bob

Offline

 

#2 2012-01-17 09:25:08

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Keeping sprites from flipping when bouncing off the edge

No. What's wrong with clicking the button?

Offline

 

#3 2012-01-17 09:40:40

birv2
Scratcher
Registered: 2008-05-15
Posts: 4

Re: Keeping sprites from flipping when bouncing off the edge

Thanks for the reply. The problem with clicking the buttons is that it asks the player, who didn't program the game, to do something the programmer should have done for him. Not all players are familiar with those buttons.

I actually came up with a fix.

1. Take the sprite and make another costume by flipping the original.
2. Name the costumes "left" and "right".
3. Put 2 different color vertical lines on the two vertical edges.
4. Have a block that tests if the sprite is touching one of those colors.
5. If it touches the one on the right, switch costume to the left-facing one.
6. If it touches the one on the left, switch costume to the right-facing one.
7. Keep the sprite moving and bouncing off the edge.

It works!

Offline

 

#4 2012-01-17 10:09:34

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Keeping sprites from flipping when bouncing off the edge

birv2 wrote:

Thanks for the reply. The problem with clicking the buttons is that it asks the player, who didn't program the game, to do something the programmer should have done for him. Not all players are familiar with those buttons.

I actually came up with a fix.

1. Take the sprite and make another costume by flipping the original.
2. Name the costumes "left" and "right".
3. Put 2 different color vertical lines on the two vertical edges.
4. Have a block that tests if the sprite is touching one of those colors.
5. If it touches the one on the right, switch costume to the left-facing one.
6. If it touches the one on the left, switch costume to the right-facing one.
7. Keep the sprite moving and bouncing off the edge.

It works!

Have the programmer click the button.  wink

Offline

 

#5 2012-01-17 10:50:37

birv2
Scratcher
Registered: 2008-05-15
Posts: 4

Re: Keeping sprites from flipping when bouncing off the edge

The programmer won't be there.  smile

Offline

 

#6 2012-01-17 16:28:06

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

Re: Keeping sprites from flipping when bouncing off the edge

If you click the button and save the project, it'll maintain that setting when you open it later. That's what it's there for.  tongue


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

Offline

 

#7 2012-01-17 17:59:26

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Keeping sprites from flipping when bouncing off the edge

How about just telling it to flip again?   tongue

[blocks]<turn cw( 180 )degrees> [/blocks]

Offline

 

#8 2012-01-18 15:04:21

birv2
Scratcher
Registered: 2008-05-15
Posts: 4

Re: Keeping sprites from flipping when bouncing off the edge

Harakou wrote:

If you click the button and save the project, it'll maintain that setting when you open it later. That's what it's there for.  tongue

I didn't know that. Thanks!

I did get some good practice in problem solving though.

Offline

 

Board footer