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

#1 2010-07-05 14:38:02

majormax
Scratcher
Registered: 2008-04-06
Posts: 1000+

A little, tiny, bit of help?

Could someone tell me what the other half of the block specs for a [When thouching %m , bounce] would be? It's like [if on edge, bounce]. I'm gonna try to do the instance on my own, so please don't post that (if there is one needed) unless I ask. Thanks in advance.
-majormax
P.S. Feel free to use this in a mod, just give me credit.

Offline

 

#2 2010-07-05 14:59:20

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: A little, tiny, bit of help?

Why not just make a  [bounce]  block?


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#3 2010-07-05 15:02:29

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: A little, tiny, bit of help?

henley wrote:

Why not just make a  [bounce]  block?

That would work... but all it is a turn 180 degrees I think.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#4 2010-07-05 15:04:42

majormax
Scratcher
Registered: 2008-04-06
Posts: 1000+

Re: A little, tiny, bit of help?

markyparky56 wrote:

henley wrote:

Why not just make a  [bounce]  block?

That would work... but all it is a turn 180 degrees I think.

Actually, I think it would be turn 90 (or -90).

Offline

 

#5 2010-07-05 15:21:35

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: A little, tiny, bit of help?

majormax wrote:

markyparky56 wrote:

henley wrote:

Why not just make a  [bounce]  block?

That would work... but all it is a turn 180 degrees I think.

Actually, I think it would be turn 90 (or -90).

Maybe... actually yeah, if you look at what light does when it hits a reflective surface at an angle of 45 degrees, if bounces off at 45 degrees, so it is 90 degrees (or -90)


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#6 2010-07-05 18:13:25

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: A little, tiny, bit of help?

But if it hits at 30 degrees it bounces off at 30 degrees which is 120 not 90.


Check out my projects if you have a chance.

Offline

 

#7 2010-07-05 19:45:30

majormax
Scratcher
Registered: 2008-04-06
Posts: 1000+

Re: A little, tiny, bit of help?

I'm not that good ant angles. That was kinda a estimated guess. I actually think climber59 is right.

Offline

 

#8 2010-07-05 20:06:36

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: A little, tiny, bit of help?

I think they should get rid of the [if on edge, bounce] block. You can do the same thing with:
[if <touching [edge]>]
[point in direction ( (180 - (direction) )]
[end if]

okay, back on topic:

so, say you name your instance 'touching:bounce.' Then the blockspec would look like ('if touching %m bounce' #- #touching:bounce)

There ya go!


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#9 2010-07-05 20:34:00

majormax
Scratcher
Registered: 2008-04-06
Posts: 1000+

Re: A little, tiny, bit of help?

Okay, I tried to do the instance, but failed.

Offline

 

#10 2010-07-05 20:36:07

majormax
Scratcher
Registered: 2008-04-06
Posts: 1000+

Re: A little, tiny, bit of help?

(that means help with the instance)

Offline

 

#11 2010-07-06 07:19:49

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: A little, tiny, bit of help?

climber59 wrote:

But if it hits at 30 degrees it bounces off at 30 degrees which is 120 not 90.

Yeah... good point, I geuss its a whole load of maths to be worked out.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#12 2010-07-06 18:21:22

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: A little, tiny, bit of help?

reflecting off a surface is simply a matter of finding the angle between the motion vector of the object and the line perpendicular to the surface, then reflecting that along the same line.


nXIII

Offline

 

#13 2010-07-07 05:10:52

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: A little, tiny, bit of help?

if you know the shape of the object you are colliding with and the direction to that object from the object doing the colliding, you should be able to get it to bounce off. I believe the most popular method is probably using slightly different colours for different sides of any object on the stage so the object knows how to bounce.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#14 2010-07-07 19:37:59

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: A little, tiny, bit of help?

sparks wrote:

if you know the shape of the object you are colliding with and the direction to that object from the object doing the colliding, you should be able to get it to bounce off. I believe the most popular method is probably using slightly different colours for different sides of any object on the stage so the object knows how to bounce.

or use a mask sprite (although I don't think any mod will actually allow you to do this yet. Someone should make a custom "pixel x:() y:() is within sprite [ v]" block)

EDIT: Oh jeez, that block looks like a bunch of unhappy faces >.>

Last edited by nXIII (2010-07-07 19:38:32)


nXIII

Offline

 

Board footer