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

#1 2009-09-22 11:04:07

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

We need a "If touching ____ bounce" block

This block would make alot of stuff a whole lot easier


I'm graduating HS this April and going to college in the Fall.

Offline

 

#2 2009-10-27 12:48:41

Jordanuk2
Scratcher
Registered: 2007-06-07
Posts: 20

Re: We need a "If touching ____ bounce" block

Doesn't need to be made, it's already possible (it's easy to make.)

Still a good idea.


Scratch really needs a English (UK) language, because I live in the UK.  neutral

Offline

 

#3 2009-10-28 04:00:39

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: We need a "If touching ____ bounce" block

That would make things really easy but it should alow for colors/colours as well.

This would help a game I made where a ball must bounce of a certain color/colour at the correct angle and for me to do this I have to use the direction that the ball is traveling in and choose which way it should rotate depending on the direction that it hits in.

Here's the link to the project contains what I mean. Download it to see how to make the ball rotate the right way depending on the direction that it hits in. (Link to project)

Last edited by what-the (2009-10-28 04:01:25)


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#4 2009-10-29 16:08:42

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: We need a "If touching ____ bounce" block

Hey Jordanuk2, I would LOVE to see how this is easily done if you have a link?

The problems I've noticed are...
1) native Bounce command only works for the edges of the screen
2) scripting your own uses a lot of Ifs, etc so most people probably just give up
3) the hidden collision sprite with multi-color feelers works well but still suffers from variable game speed limitations among others
4) If Touching depends on how fast the object(s) are moving cause if they change direction but are still touching on the next collision check, you get a stuck object, bad angle, etc. I am currently trying to work around this using a Touching variable that only resets after the objects stop touching and also by making the moving/bouncing object travel a big step (Move) in the new direction before resuming the collision detection loop. I also use a ssytem like What-the mentioned and now I'm wondering if I couldn't use on of the directional flags instead of trying to make the bouncing object jump back out of the "touching" state before it gets checked again.


I plan to work on my next idea but even if it works, most people will never use it. It is like the way they do 3d. Instead of sensing if things are touching and using Move, it will compute direction as a line intersecting another line, say a border. Then it will Glide the object there, figuring it's speed by the distance to be traveled adjusted by a constant in order to make the overall speed adjustable. This should both eliminate the "stuck in the wall" loop and (hopefully) make projects run faster online. I've done it before using macros, just not in Scratch yet.

ps.. Steppenwolf.. I don't think they can make a functional Bounce Off Sprite  command like you suggested unless they make every sprite react like a square when this command is used... which would still be cool and help a LOT of people out.

Last edited by Locomule (2009-10-29 16:12:51)


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#5 2011-06-15 20:10:13

ShaneO
New Scratcher
Registered: 2010-07-12
Posts: 1

Re: We need a "If touching ____ bounce" block

ok so i have a kid who is making a race track game and he wants you to have to stay on the track like in nascar...every game i find on here has the car or marble go slower on a different color...not bounce....for instance his "car" is a monkey and the outline of the track is black but because the track is a square or rectangle and there is all 4 directions it cant just be a simple opposite of what the car is moving...they havent gotten to velocity yet so it is simply a change X and Y by a number with a repeat...please help!

Offline

 

#6 2011-06-27 15:31:11

joeknex
New Scratcher
Registered: 2010-10-06
Posts: 7

Re: We need a "If touching ____ bounce" block

I need that to!!!

Offline

 

#7 2011-06-27 22:14:42

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: We need a "If touching ____ bounce" block

<when green flag clicked><forever if><touching[ <point in direction( ((180  <-> direction  ))

That's the untidy script  big_smile


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#8 2011-06-29 09:56:23

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: We need a "If touching ____ bounce" block

ssss wrote:

<when green flag clicked><forever if><touching[ <point in direction( ((180  <-> direction  ))

That's the untidy script  big_smile

It doesn't work, that just flips you around. Throw something at a wall and tell me if that happens.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#9 2011-06-29 19:22:12

Dinoclor
Scratcher
Registered: 2010-06-10
Posts: 1000+

Re: We need a "If touching ____ bounce" block

I agree. It would be very useful.


This is a temporary signature. It will exist until I think of something witty.

Offline

 

#10 2011-06-29 19:35:36

jslomba
Scratcher
Registered: 2009-09-25
Posts: 1000+

Re: We need a "If touching ____ bounce" block

or 'if <> bounce'


the the the the the

Offline

 

#11 2011-06-30 03:47:03

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: We need a "If touching ____ bounce" block

I'm pretty sure you use
<if><touching[ ]
<point in direction((( 360 <-> <direction> ))
<end>

But I think that only works on the horizontal axis.

I use it in my pong project

|
|
\/


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#12 2011-06-30 05:11:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: We need a "If touching ____ bounce" block

juststickman wrote:

ssss wrote:

[blocks]<when green flag clicked><forever if><touching[ <point in direction( ((180  <-> direction  ))[/blocks]

That's the untidy script  big_smile

It doesn't work, that just flips you around. Throw something at a wall and tell me if that happens.

It does if the wall is perfectly round...  tongue

Last edited by LS97 (2011-06-30 05:12:06)

Offline

 

#13 2012-07-21 12:03:55

blargin
Scratcher
Registered: 2012-07-06
Posts: 49

Re: We need a "If touching ____ bounce" block

If touching [Sprite1 v]  bounce //The block should be blue.(Motion)
Could someone who knows the code give me the code for that to put in scratch?

Last edited by blargin (2012-08-06 08:17:01)

Offline

 

#14 2012-07-21 12:06:18

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: We need a "If touching ____ bounce" block

blargin wrote:

If touching [Sprite1 v]  bounce
Could someone who knows the code give me the code for that to put in scratch?(The block should be blue.(Motion))

Necropost.


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#15 2012-07-21 12:41:31

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: We need a "If touching ____ bounce" block

Here is the proper code:

when gf clicked
forever
 if <touching [wall v]?>
 point in direction ((0) - (direction))
 end

Last edited by berberberber (2012-07-21 12:41:39)


http://i47.tinypic.com/2iaa73k.png

Offline

 

#16 2012-07-21 13:24:51

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: We need a "If touching ____ bounce" block

berberberber wrote:

Here is the proper code:

when gf clicked
forever
 if <touching [wall v]?>
 point in direction ((180) - (direction))
 end

It should be 180.

Last edited by Firedrake969 (2012-07-21 13:25:06)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#17 2012-07-21 22:57:41

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: We need a "If touching ____ bounce" block

Firedrake969 wrote:

berberberber wrote:

Here is the proper code:

when gf clicked
forever
 if <touching [wall v]?>
 point in direction ((0) - (direction))
 end

It should be 180.

No, that just turns it around.  Mine actually reflects.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#18 2012-07-22 11:07:40

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: We need a "If touching ____ bounce" block

berberberber wrote:

Firedrake969 wrote:

berberberber wrote:

Here is the proper code:

when gf clicked
forever
 if <touching [wall v]?>
 point in direction ((0) - (direction))
 end

It should be 180.

No, that just turns it around.  Mine actually reflects.

My pong game I used 0, and it glitched.  Using 180, it works.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#19 2012-07-22 11:18:08

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: We need a "If touching ____ bounce" block

Well, it works for me.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#20 2012-07-29 10:03:51

blargin
Scratcher
Registered: 2012-07-06
Posts: 49

Re: We need a "If touching ____ bounce" block

SciTecCf wrote:

blargin wrote:

If touching [Sprite1 v]  bounce
Could someone who knows the code give me the code for that to put in scratch?(The block should be blue.(Motion))

Necropost.

I don't get it.

Offline

 

#21 2012-07-30 15:34:50

nama
Scratcher
Registered: 2010-06-06
Posts: 1000+

Re: We need a "If touching ____ bounce" block

blargin wrote:

SciTecCf wrote:

blargin wrote:

If touching [Sprite1 v]  bounce
Could someone who knows the code give me the code for that to put in scratch?(The block should be blue.(Motion))

Necropost.

I don't get it.

A "Necropost" is when someone posts in a thread that has not been posted in for months.
They are generlly discouraged on scartch.


You say goodbye to 1.4, I say hello to 2.0.

Offline

 

#22 2012-07-30 21:32:33

jslomba
Scratcher
Registered: 2009-09-25
Posts: 1000+

Re: We need a "If touching ____ bounce" block

^unless it relates to the discussion


the the the the the

Offline

 

#23 2012-08-05 15:33:53

blargin
Scratcher
Registered: 2012-07-06
Posts: 49

Re: We need a "If touching ____ bounce" block

nama wrote:

blargin wrote:

SciTecCf wrote:

Necropost.

I don't get it.

A "Necropost" is when someone posts in a thread that has not been posted in for months.
They are generlly discouraged on scartch.

oh                                                  ^^^^^^^ scartch??

Last edited by blargin (2012-08-09 12:13:34)

Offline

 

Board footer