Skip to main content
tiborf16537063
Participant
Jan 14, 2023 9:09 AM UTC
Answered

increase drop area

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 is closed to new replies. Start a new post to keep the conversation going.
    kglad
    kgladCorrect answer
    Community Expert
    Jan 14, 2023 2:34 PM UTC

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

    3 replies

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    Jan 14, 2023 2:34 PM UTC

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

    Translate
    tiborf16537063
    Participant
    Jan 15, 2023 7:18 AM UTC

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

    Translate
    kglad
    Community Expert
    Community Expert
    Jan 15, 2023 1:37 PM UTC

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

    Translate