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

#1 2012-05-08 16:38:30

shpeters
Scratcher
Registered: 2011-12-11
Posts: 100+

An idea for a new script block

I think that it would be a good idea to have "when touching <sprite> bounce" script. The "if on edge bounce" script works well and is often used but in many projects there are things in the middle that scratchers would like a sprite to bounce on. While there already is a way to do this, it is rather complicated and it would be much easier for scratchers if they could add it in a single block of code.


http://i.imgur.com/bboYO.pnghttp://i.imgur.com/66Yki.gifhttp://i.imgur.com/uLUsl.jpg

Offline

 

#2 2012-05-08 16:50:12

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: An idea for a new script block

That'd only be possible if the sprite was a square or something. It's impossible to detect the gradient of a side of a sprite, so it's impossible to make it bounce accurately using that one block.


Why

Offline

 

#3 2012-05-09 18:43:37

shpeters
Scratcher
Registered: 2011-12-11
Posts: 100+

Re: An idea for a new script block

What about a block that bounced when touching a certain color?


http://i.imgur.com/bboYO.pnghttp://i.imgur.com/66Yki.gifhttp://i.imgur.com/uLUsl.jpg

Offline

 

#4 2012-05-09 18:45:41

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: An idea for a new script block

It'd still be impossible to detect the gradient.

It can be done with advanced trigonometery though. There's a fantastic project I saw a while back, I'll see if I can find it (I'm not hopeful though)


Why

Offline

 

#5 2012-05-10 11:26:58

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: An idea for a new script block

It's possible in game maker. I support, because the bounce scripts I make myself always get really glitchy.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#6 2012-05-23 10:13:40

SimpleScratch
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: An idea for a new script block

In the very early days of Scratch I tried very very hard to get the community to accept the usefullness of such a block for younger scratchers but couldn't get any takers  sad .

However, it should be possible in 2.0 for advanced scratchers to code up such a block (with all the variations on its action - bounce/reverse/reflect ) and then share it out with others  smile

Offline

 

#7 2012-05-23 10:17:39

SimpleScratch
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: An idea for a new script block

@RedRocker - "impossible"  smile

You could make some assumptions and treat the two sprites as circles and do the "bounce" calculations based on that maybe?

Simon

Offline

 

Board footer