Extension Suggestion: Canvas: Balls, Sprites Pass Event

Sprites and Balls - introduce a new event "Pass". A Pass event is essentially the same code as a [Drag event + Touch] on the Sprite or Ball, except:

  1. The Sprite/Ball is not moved
  2. The event can be triggered multiple times by the same continuous drag motion.

This would typically be advantageous when the User is dragging a Sprite, and the drag path goes over a neighbouring sprite - the neighbour is 'passed'. Think of things like lap counters and trackers in games.

In the diagram, the blue sprite is stationary and is being passed by the green sprite when it is dragged right to left and back again left to right, without pause or 'touch up'. Every time the Green Sprite/Ball passes the Blue Sprite/Ball, the Blue Sprite's Pass Event is triggered.

Sprite Event Pass

Blocks Sprite Event Pass

Similar Blocks for image sprites.

An adventurous developer that loves grey hair might like to produce more advanced Blocks that inform which Sprite/Ball triggered the Pass Event

No extension required ?

image

works with a ball and sprite too...

image

1 Like

Hi Tim, it is not the moving sprite that we want the data from, it is the stationary sprite/ball?

In which case

image

ImageSprite1 is the blue square, Ball1 is magenta, ImageSprite2 is the green circle

image

You can get the object that the blue square collided with from other (maintain a list of objects, and a list of their names)

... can I have your Project file? Edit: There will be a minimum 36 'ImageSprite1s'.

spritePass.aia (2.8 KB)

I have only done the very basics, as a demo.

Hmm, can't get it to work with the steering wheel sprite example. Strangely, no collision detected - but it would not help if it did, because all 7 Balls are in a collision state with the steering wheel sprite at the same time from the get-go. Drag without moving the Balls works, but only once. Given that the wheel sprite is constantly on the move, Drag is therefore not the answer.

In a desktop or text based program you could use vectors or rays. Too much overhead to define in Blocks.

1 Like