Skip to main content
tiborf16537063
Participant
January 14, 2023
Answered

increase drop area

  • January 14, 2023
  • 1 reply
  • 208 views

Hi!

 

I want to increase a dropzone success detection area from html5 code.

Teh working code is here: 

root.check = function()
{
	var spot = slots.getObjectUnderPoint(pieces.target.x, pieces.target.y);
	
	if (!spot)
	{
		root.onMiss();
		return;
	}
	
	root.slot = spot.parent;
		
	if (root.slot)
	{		
		if (pieces.target.name === root.slot.name)
		{
			root.onMatch();
			
			if (pieces.count === pieces.children.length)
				root.onWin();
		}
		else
			root.onMiss();
		
		root.slot = null;
	}
	else
		root.onMiss();
};

 

How can i extend the sucess area, so that you don't have to throw it exactly right to succeed?

Thanx!

    This topic has been closed for replies.
    Correct answer kglad

    one way would be to extend the background (and you can use something with an alpha of 1) of the drop targets.

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    January 14, 2023

    one way would be to extend the background (and you can use something with an alpha of 1) of the drop targets.

    tiborf16537063
    Participant
    January 15, 2023

    @kglad you saved me master! Its working like a charm!

    kglad
    Community Expert
    Community Expert
    January 15, 2023

    excellent!  (and thanks for the follow-up.)