Discuss Scratch
- Discussion Forums
- » Suggestions
- » What the if on edge, bounce block should be replaced with
- shoresbeep
-
1000+ posts
What the if on edge, bounce block should be replaced with
no support because:
if <touching [edge v] ?> then
point in direction ((180) - (direction))
end
Last edited by shoresbeep (Nov. 16, 2014 02:46:53)
- ShamelessSnores
-
100+ posts
What the if on edge, bounce block should be replaced with
It wasn't you exactly, it was the other guy… Also it's a good idea to read through the thread before you post… That way you could've had seen that he had necropostedThere's no way you could bounce off a general shape without calculus. And, as A-no-meep said, there would be an issue with diagonal bitmap surfaces.
Let 0 be the surface, 1 be the impactor, and represent all other pixels. It will look like this before impact:
0
00 1
000 111
0000 1
00000
000000
0000000
00000000
000000000
If the impactor continues to move, say, southwest, it will look like this:
0
00
000
0000 1
00000111
0000001
0000000
00000000
000000000
But what will it do? It can't determine an orientation. If it had to randomly choose from up or right, it would look wonky regardless of the outcome:
0 1
00 111
000 1
0000
00000
000000
0000000
00000000
000000000
This violates the laws of reflection! If it was a bigger diamond-shape or octagon, it would get stuck. If it touched the surface by the corners, it wouldn't be able to find an orientation. If it decides to reflect back, it will again violate the laws of reflection for any surface that is not “perpendicular” to the impactor's “direction”.
The only way to determine the “angle” of the bitmap surface is to analyze the surrounding pixels and estimate the reflection angle, which, again, requires the use of calculus.
However, this is not an issue with vectors, as you can design a program with an extra sprite that measures the orientation and tells the shape which way to go.Please do not necropost.(bounce :: motion)Whaaaa? Bounce of what angle? What edge? And what if it is touching two things?
I'm telling you why the “bounce” block won't work! How is that a necropost?
- scottpease
-
4 posts
What the if on edge, bounce block should be replaced with
I want to add support for a more generalized “bounce” block.
We would like to be able to “bounce” our sprites off of other sprites or colors.
Thanks,
SP
We would like to be able to “bounce” our sprites off of other sprites or colors.
Thanks,
SP
- stickfiregames
-
1000+ posts
What the if on edge, bounce block should be replaced with
That only works if you are bouncing off a horizontal line.if <touching [edge v] ?> then
point in direction ((180) - (direction))
end
No support.
There is a way to bounce off a straight line with a known angle, or a circle with a known centre. The reason why there will never be a generic “bounce” block is because there is no way to calculate the angle to bounce off without complex calculations that would slow down the project.
- ijohn007
-
100+ posts
What the if on edge, bounce block should be replaced with
Just do this:
...
if <touching [Thing v] ?> then
turn ccw (180) degrees
end
...
- Braeden5454
-
500+ posts
What the if on edge, bounce block should be replaced with
no support because:if <touching [edge v] ?> then
point in direction ((180) - (direction))
end
That doesn't work very well.
- ijohn007
-
100+ posts
What the if on edge, bounce block should be replaced with
no support because:if <touching [edge v] ?> then
point in direction ((180) - (direction))
end
That doesn't work very well.
Just do this:...
if <touching [Thing v] ?> then
turn ccw (180) degrees
move (10) steps
end
...
- danielhal
-
100+ posts
What the if on edge, bounce block should be replaced with
Bounce is basically turn 180 degrees…
- __init__
-
1000+ posts
What the if on edge, bounce block should be replaced with
Whoops, I did NOT mean to support this. Stupid MSU.
Last edited by __init__ (Nov. 30, 2014 22:14:48)
- donotforgetmycode
-
1000+ posts
What the if on edge, bounce block should be replaced with
I agree. I think there should be anif touching [edge v], bounce :: motionblock instead. You can't bounce off of nothing!
We also need these blocks:
if touching colour [#ccccff], bounce :: motion
if colour [#ff0000] touching [#aaaaaa], bounce :: motion
if on mouse, bounce :: motion
Last edited by donotforgetmycode (April 8, 2018 13:47:45)
- -ShadowOfTheFuture-
-
1000+ posts
What the if on edge, bounce block should be replaced with
How would this bounce block work? If there was an
if on [sprite1 v], bounce :: motionblock, what would happen if the sprite was completely within the sprite it was supposed to bounce off of?
- DaEpikDude
-
1000+ posts
What the if on edge, bounce block should be replaced with
meganecro, much?I agree. I think there should be anif touching [edge v], bounce :: motionblock instead. You can't bounce off of nothing!
We also need these blocks:if touching colour [#ccccff], bounce :: motion
if colour [#ff0000] touching [#aaaaaa], bounce :: motion
if on mouse, bounce :: motion
also it's semi-rejected
Last edited by DaEpikDude (April 8, 2018 21:11:40)
- ihgfedcba
-
100+ posts
What the if on edge, bounce block should be replaced with
Also, as someone said, diagonal angles cannot be reliably recognized on bitmap pictures, as edges are only either horizontal or vertical. How would this bounce block work? If there was anIt's not going to work. No support.if on [sprite1 v], bounce :: motionblock, what would happen if the sprite was completely within the sprite it was supposed to bounce off of?
- Discussion Forums
- » Suggestions
-
» What the if on edge, bounce block should be replaced with