Discuss Scratch

iNeverBrokeTheRules
Scratcher
70 posts

New Block? [When % of Sprite 1 is touching Sprite 2]

So If you want a sprite to do something only when it is fully touching another, this is a good idea
When (50)% of [Sprite1] is touching [Sprite2]

It's like the
repeat ()

end
Block, but you put the code UNDER instead of IN the block.
Is this a good idea?

100= whole
75= One third
50= half
25= Quarter

Last edited by Paddle2See (June 17, 2019 13:42:19)


Hey guys
forever
play sound [LOL ]
end

Now I will put a link to the image, Scratch doesn't let me put it here
https://photos.google.com/photo/AF1QipMUHAJnYJ_hhIPwvD2jLe9s6MPTfLZaiWy4ceZM
ResExsention
New to Scratch
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

How exactly would this work? What is “fully touching”? Does it mean that one sprite is overlapping another sprite? Could you explain some practical uses?

Infrequently active.

It feels weird to see how far we've come. I hope you're well, wherever you are!
cheesyfriedeggs
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

i'm confused by this.
Truck11111
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

what
can you explain

Last edited by Truck11111 (May 21, 2019 13:20:56)


sufferin' succotash!
Tallented-Code-bot
Scratcher
100+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

If it means that the one sprite is on top of another sprite, than no support. If sprite one were very small, and sprite two was very big, than sprite 1 could not be fully covering sprite 2. There is also really no way of measuring the percent that a sprite it touching another sprite. Another thing, what would happen if one sprite or the other were to change costumes or hide at the same time. Would the block still work?
iNeverBrokeTheRules
Scratcher
70 posts

New Block? [When % of Sprite 1 is touching Sprite 2]

No! It doesn't mean a sprite is covering 100%, It means that the whole sprite is touching another, just imagine There was a block in the middle of screen, and you have a smaller block, and you only want it to do something when Every Single Pixel of the Smaller Cube Is touching the Big Cube, It doesn't have to cover the thing, just make full contact with the whole thing, so for any mis-understandings
play sound [ Sorry!] until done

Last edited by iNeverBrokeTheRules (May 21, 2019 14:44:41)


Hey guys
forever
play sound [LOL ]
end

Now I will put a link to the image, Scratch doesn't let me put it here
https://photos.google.com/photo/AF1QipMUHAJnYJ_hhIPwvD2jLe9s6MPTfLZaiWy4ceZM
Truck11111
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

iNeverBrokeTheRules wrote:

No! It doesn't mean a sprite is covering 100%, It means that the whole sprite is touching another, just imagine There was a block in the middle of screen, and you have a smaller block, and you only want it to do something when Every Single Pixel of the Smaller Cube Is touching the Big Cube, It doesn't have to cover the thing, just make full contact with the whole thing, so for any mis-understandings
play sound [ Sorry!] until done
oh
i dont really see a use for this yet

sufferin' succotash!
GiggyMantis
Scratcher
65 posts

New Block? [When % of Sprite 1 is touching Sprite 2]

I just died reading this.

iNeverBrokeTheRules wrote:

75= One third

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
codeman1044
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

GiggyMantis wrote:

I just died reading this.

iNeverBrokeTheRules wrote:

75= One third
Something seems off… that could just be me.
75% = 0.75. One third = 33% = 0.33… HHHMMMMMmmmm…
Anyways, I would kind of support this, but I could see it being more useful as a boolean:
<Percentage of [sprite1 v] touching [sprite2 v]?::sensing> 
Instead of
when (50) % of [sprite1 v] is touching [sprite2 v]::events hat 
This block could actually cause quite a bit of lag. It might even lead to more lag than the touching color block. *Shudder*
It would have to check and see how many pixels are in each sprite and how many of them are touching each other, then do the math, then check and see if the result is equal to the input. Every single frame. This would probably be laggy. Obviously, the boolean might be laggy as well, but it wouldn't constantly run as an event block would, and it would require less computation.
Summary: support if the boolean is added.

Last edited by codeman1044 (June 14, 2019 21:48:12)


This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
iNeverBrokeTheRules
Scratcher
70 posts

New Block? [When % of Sprite 1 is touching Sprite 2]

e

Last edited by iNeverBrokeTheRules (June 14, 2019 23:23:48)


Hey guys
forever
play sound [LOL ]
end

Now I will put a link to the image, Scratch doesn't let me put it here
https://photos.google.com/photo/AF1QipMUHAJnYJ_hhIPwvD2jLe9s6MPTfLZaiWy4ceZM
--Snowball--
Scratcher
500+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

GiggyMantis wrote:

I just died reading this.

iNeverBrokeTheRules wrote:

75= One third

:O Wow.




Anyway, I immediately start to see some problems with this. First of all, this should either be a “wait until” block or a hat block with an “if then”. And Talented-Code-bot pointed out some problematic things with this. No support for now.

I've since moved on from Scratch, and now I'm making games in the Godot Engine, music in LMMS, art in Photoshop, and other various things that aren't involving this website anymore. Thanks to Scratch for getting me interested in this stuff!
mica43683
Scratcher
500+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

codeman1044 wrote:

GiggyMantis wrote:

I just died reading this.

iNeverBrokeTheRules wrote:

75= One third
Something seems off… that could just be me.
75% = 0.75. One third = 33% = 0.33… HHHMMMMMmmmm…
Anyways, I would kind of support this, but I could see it being more useful as a boolean:
<Percentage of [sprite1 v] touching [sprite2 v]?::sensing> 
Instead of
when (50) % of [sprite1 v] is touching [sprite2 v]::events hat 
This block could actually cause quite a bit of lag. It might even lead to more lag than the touching color block. *Shudder*
It would have to check and see how many pixels are in each sprite and how many of them are touching each other, then do the math, then check and see if the result is equal to the input. Every single frame. This would probably be laggy. Obviously, the boolean might be laggy as well, but it wouldn't constantly run as an event block would, and it would require less computation.
Summary: support if the boolean is added.
It should be a ring.
(percentage of [sprite1 v] touching [sprite2 v]?::sensing) 

You wouldn't use

if <percentage of [sprite1 v] touching [sprite2 v]?::sensing> then
...
end

Or it could be
<[sprite1 v] touching (50)% of [sprite2 v]?::sensing> 

If it was a ring, it could be used as
if <(percentage of [sprite1 v] touching [sprite2 v]?::sensing) = [50]> then
...
end

I semi-support this.

I got a lot of compliments on my last signature, and I think that's kind of strange. I wrote it when I was 12 and it wasn't very good. I acted like PS4 controllers were the epitome of human technology, for God's sake! I tried too hard to be philosophical, or maybe I tried too hard to be funny, or maybe it was something else. But that signature was bad. It wasn't good. It might be strange for some of you to hear this, seeing as this site is full of kids, but 12-year-old me was practically a baby. I think that's something you realise when you grow up. That you're always better than you were last year. I was looking through old Skype messages between me and a friend of mine from when we were 12, and as I read them, I couldn't stop thinking, “Woah. I was the worst.” It's important to know that you're always the worst. I can almost guarantee that future you is thinking negatively of you right now, just as future me is thinking negatively of me. It's important not to let that get to you. Remember to stay in the present. Tomorrow hates you, but it can't hurt you because you'll never get to tomorrow. When I was 10 or 11, I remember seeing the world very cynically. I thought that human life was inherently selfish, and that we were only put on this planet to destroy it. I'm so glad 10 or 11 year old me is gone, because 17 year old me would NOT get along with that kid.
CatsUnited
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

No Support for the moment, because this block sounds like it would just cause a ton of lag. After all, what it's doing is having to check every pixel of two sprites to check if that pixel of the first sprite is touching the second sprite, and then calculating the number of pixels that are touching to the number of pixels that aren't, and then doing that for every frame. I know that this block would be useful, I'm just worried that it'd be really laggy.

bottom text
SadNoob
Scratcher
27 posts

New Block? [When % of Sprite 1 is touching Sprite 2]

CatsUnited wrote:

No Support for the moment, because this block sounds like it would just cause a ton of lag. After all, what it's doing is having to check every pixel of two sprites to check if that pixel of the first sprite is touching the second sprite, and then calculating the number of pixels that are touching to the number of pixels that aren't, and then doing that for every frame. I know that this block would be useful, I'm just worried that it'd be really laggy.
Doesn't Scratch already check for every pixel of two sprites with the “touching ()” block? Calculating the number of pixels that are touching isn't that big of an issue. Although I'd assume Scratch's touching blocks can short-circuit (if a pixel is found that is touching the other sprite, so we don't need to check any other pixels), having a sprite on the last pixel Scratch would check could also cause lag, but this doesn't seem to be a problem. I do agree that this could impact performance, but Scratch is already able to do a lot of touching calculations at a fast speed.

View all my posts

Dislike Scratch 3.0? You can still download the old editor!


EsOayXeftsRCBCtNOaOxFoBisLdapjtnhZejDemXWlHgPSGGyt
codeman1044
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

mica43683 wrote:

It should be a ring.
(percentage of [sprite1 v] touching [sprite2 v]?::sensing) 
Yep. I was really tired when I posted that. It obviously should be a ring, because it could return over 2 values (instead of true/false)
Whoops.

Last edited by codeman1044 (June 15, 2019 17:02:25)


This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
charmander1059
Scratcher
46 posts

New Block? [When % of Sprite 1 is touching Sprite 2]

pen left
And
pen right

Hey! I'm Charmander1059. I love Tusken raiders, and Henry Stickmin. I've even made fangames for Henry Stickmin! Heres my best one:
https://scratch.mit.edu/projects/798518787/. If you liked my comment, consider following. Thanks for being you!
Nambaseking01
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

Support. This will be more efficient. If some of you are getting confused on how a programmer will define the percentage, how did you try to memorize the X and Y positions? This is the same!

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
WindOctahedron
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

charmander1059 wrote:

pen left
And
pen right
Please create a separate topic. That way, more people will actually see it.

The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
Mr_PenguinAlex
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

Support, it could be useful.

coder2045
Scratcher
1000+ posts

New Block? [When % of Sprite 1 is touching Sprite 2]

charmander1059 wrote:

pen left
And
pen right
Please don't hijack threads. (Read bottom of signature)

Highlight this text and press Ctrl-Shift-Down to view more of my signature. There's a lot in there.
I FOUND THE POSTIE POSTIE POST LINK THIS
Brainteaser: What comes next? Answer on my profile. First correct answer gets a follow.

[ ]
[ [ ] ]
[ [ [ ] ] [ ] ]
Good projects ⬇️




Powered by DjangoBB