Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:27:59+00:00 2026-05-24T21:27:59+00:00

can someone help me with the following problem please: In my game there appear

  • 0

can someone help me with the following problem please:

In my game there appear scores when you shoot down enemies. That kinda works so far but they overlap when the enemies were too close to each other when shot down.
Now what I’d like to do is to prevent the overlapping of the scores. The basic idea I had was to loop through the array of scores and to check the distance to each other.
Problem is that it doesn’t work. Can someone help please?

private function checkScoreDistance():void
{
scoreManager.scoreCount = scoreManager.scores.length;
if (scoreManager.scoreCount >= 1)
{
    scoreManager.scoreCount = scoreManager.scores.length - 1;
    scoreManager.scoreCountTwo = scoreManager.scores.length - 2;

    scoreOne: for (var scoreCtr:int = scoreManager.scoreCount; scoreCtr >= 0; scoreCtr--)
    {

        tempScore = scoreManager.scores[scoreCtr];
        tempScore.point.x = tempScore.x;
        tempScore.point.y = tempScore.y;
        oldtempScoreX = tempScore.x;
        oldtempScoreY = tempScore.y;

        var tempScoreTwo:Score;
        scoreTwo: for (var scoreCtrTwo:int = scoreManager.scoreCountTwo; scoreCtrTwo >= 0; scoreCtrTwo--)
        {
            tempScoreTwo = scoreManager.scores[scoreCtrTwo];
            tempScoreTwo.point.x = tempScoreTwo.x;
            tempScoreTwo.point.y = tempScoreTwo.y;

            oldtempScoreTwoX = tempScoreTwo.x;
            oldtempScoreTwoY = tempScoreTwo.y; 

            var scoresX:Number; 
            scoresX = oldtempScoreTwoX - oldtempScoreX;

            var scoresY:Number;
            scoresY = oldtempScoreTwoY - oldtempScoreY;

            var dist:Number;

            dist = Math.sqrt(scoresX * scoresX + scoresY * scoresY);

            if (dist <= 25)
            {
                oldtempScoreX -= 25;
                oldtempScoreTwoX += 25;

                oldtempScoreY -= 25;
                oldtempScoreTwoY += 25;
                }

            }

        }
    }
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:28:00+00:00Added an answer on May 24, 2026 at 9:28 pm

    Um, you seem to be lacking some code to do something with the values you compute in oldtempScoreX and oldtemScoreTwoX. Apparently there is nothing to actually move anything based on the calculations …

    Also, what if an object is bumped left because it has a close neighbor to the right and then afterwards is bumped right because it now has a close neighbor to the left?

    Also also: You seem to be blindly bumping oldtempScore to the northwest and oldtempScoreTwo to the southeast, without actually checking that their relative position is such that this makes sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone offer some help with my problem please? I have the following code:
Please can someone help? I have the following code which uploads a file to
Can someone please help me figure out a way to achieve the following (see
Can someone please help me with the following code? The methods runs until ss.accept();
I wonder whether someone can help me please. I've put together the following which
Can someone help explain the following: If I type: a=`ls -l` Then the output
I have a query with regards to pointers, can someone help explain the following
Can someone help me figure out the following make file? BINS=file1 file2 file3 all:
Can someone help me figuring out why the following jQuery code doesn't work? I
can someone help with this? I need the following function to do this... $x

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.