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

#1 2007-05-18 22:55:06

Greatness
Scratcher
Registered: 2007-05-10
Posts: 19

<touching colour/sprite> query

For the Tetris project, i need the blocks to sense when it is touching another block.

I have seen that it only executes the code when it is over the object/colour, not when it is next to it.

Is there anyway to increase the range of the sensor by a pixel or so, so if it is next to it, it still classifies it as 'touching'

Thanks in advance.

Offline

 

#2 2007-05-19 01:45:08

Amblin
Scratcher
Registered: 2007-05-17
Posts: 7

Re: <touching colour/sprite> query

Hi greatness, I'm working on the same problem.

Currently the collision detect isn't right in scratch. It doesn't centre correctly to the sprites.

I'm going with a work around. Hopefully I'll be able to post it later today. I'm working with ranges, Which in isolation appears to work.

ALso due to the limitations of the stamp function, I'd go for a large number of sprites to call from instead, using a random for selection.

Good luck and i'll keep you posted.

Offline

 

#3 2007-05-19 09:28:39

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: <touching colour/sprite> query

Here's a possible technique to try: use a one-pixel dot just outside the block as a "sensor" to detect collisions. You could switch to a costume without the dot before stamping the block. I think if you make the dot the right color it won't be very noticable as the block is falling. Jay used this trick in the new version of PacTag that comes with Scratch 1.1.

  -- John

Offline

 

Board footer