Discuss Scratch

WolfCat67
Scratcher
1000+ posts

"If touching [insert something other than edge], bounce" Block!

Not sure if this is a duplicate (couldn't be bothered to check), but…
What I'm suggesting is a block that looks like this:
if touching [edge v], bounce :: motion
This would be amazing, and could replace the
if on edge, bounce
block. How many times have you been working on a platformer, a pong game, or something else and want to use the “if on edge, bounce” block but for some drawn sprites? I know that I have been wanting this instead of having to go through a process of Boolean inputs and variables. Just look at this:
if touching [Sprite1 v], bounce :: motion

If the Scratch Team wanted, they could probably also add this in!
if touching color [#1143ed], bounce :: motion
I know there is an easy workaround, but the “if on edge, bounce” block also has many easy workarounds as well and this would just be here to make everything easier.

Last edited by WolfCat67 (Oct. 31, 2016 02:42:42)


1004587
Scratcher
1000+ posts

"If touching [insert something other than edge], bounce" Block!

Pretty “edgy” suggestion there, eh?

i'm so sorry for that joke

Anyways, pretty sure this is a duplicate, but I don't have the link .
Parametric
Scratcher
91 posts

"If touching [insert something other than edge], bounce" Block!

This is impossible, since there's no way for a sprite to know the angle of whatever it's bouncing against. If by “bounce”, you just mean “reverse direction” without any bearing on the angle of the surface, use this instead:

when green flag clicked
forever
if <touching [thing v] ?> then
turn cw (180) degrees
end
end
nickeljorn
Scratcher
1000+ posts

"If touching [insert something other than edge], bounce" Block!

Parametric wrote:

This is impossible, since there's no way for a sprite to know the angle of whatever it's bouncing against. If by “bounce”, you just mean “reverse direction” without any bearing on the angle of the surface, use this instead:

when green flag clicked
forever
if <touching [thing v] ?> then
turn cw (180) degrees
end
end

I've heard about that before.

"Just what is the Summer Solstice, besides the day I melt into a puddle of fuzzy puppy fluff?”-Isabelle, Animal Crossing New Leaf
braxbroscratcher
Scratcher
1000+ posts

"If touching [insert something other than edge], bounce" Block!

It's possible, but it's hard. You'd need a lot of code. For such pong games, just make it so it teleports to the bottom/top edge whenever it hits the paddle; then make it teleport back after changing direction.


My signature is kumquat proof.
But not tangerine pro-
nomnomnomnomnom










Current Project:
n/a
Quotes: “In our last hour, we burn the most brightly, trying to deny that we are burning out.” -Me
“Well, no. 1024 Killerbytes make a Murderbyte.” -MegaByteCorporations
“I hate out of context quotes.” -Me
“I hate it when Cubeupload breaks.” -Also me

Powered by DjangoBB