• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

increase drop area

Community Beginner ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

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!

Views

119

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 14, 2023 Jan 14, 2023

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

Votes

Translate

Translate
Community Expert ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2023 Jan 15, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines