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 399297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:49:57+00:00 2026-05-12T16:49:57+00:00

I have a task: I need to place about 100 sprites on one canvas

  • 0

I have a task:

I need to place about 100 sprites on one canvas (with prepared grid on it). I need to place them as invisible (circles) stones, on the board, and make visible only on mouseover.

The problem I come across is following, I can’t place those objects accurately into the nodes on the grid.

E.g.

if I define stones (it’s just a sprite, as I said earlier) this way:

var stone:StoneSprite = new StoneSprite();
    stone.x = this.x + 2*cellWidth;
    stone.graphics.beginFill( 0x000000 );
    stone.graphics.drawCircle(stone.x , this.y + cellWidth, cellWidth/3 );
    stone.graphics.endFill();
    rawChildren.addChild(stone);

They don’t sit on the node…
See image:
http://img.skitch.com/20091014-kuhfyjeg1g5qmrbyxbcerp4aya.png

And if I do it this way:

var stone:StoneSprite = new StoneSprite();
    stone.graphics.beginFill( 0x000000 );
    stone.graphics.drawCircle(this.x + 2*cellWidth , this.y + cellWidth, cellWidth/3 );
    stone.graphics.endFill();
    rawChildren.addChild(stone);

The stone is displayed correctly in the grid node… See image 2:
http://img.skitch.com/20091014-f595tksjxramt98s7yfye591bh.png

So I wonder what is the difference between these 2 approaches.

Also, I think I need to pass correct coordinates to the stone class… In case I would like to change some properties of the stone object. E.g. visibility, or radius.

  1. Could you please suggest, what’s wrong in defining coordinates as stone.x, stone.y
  2. How to fix the problem with incorrect positioning.

Would really appreciate ideas about the problem, I am trying to solve for so long 🙁

  • 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-12T16:49:58+00:00Added an answer on May 12, 2026 at 4:49 pm

    Assume x & y are 30 and cellWidth is 30.

    First Example:

    stone.x = 30 + 60; //90
    drawCircle(90, 60, 10);
    

    This means if you were to draw a rectangle around your circle, it would be at [170,50]. (x,y).

    Second Example:

    stone.x = 0;
    drawCircle(90, 60, 10)
    

    This means the rectangle around your circle is at [80,50];


    In the first example, you are moving the sprite to position x==90. Then drawing a circle whose center is at x==90 inside the sprite. So relative to this, you’re at x==180. But because a circle’s x,y coords are the center, subtract 10 for the radius to get the boundary x position.

    In the second example, the sprite defaults to position x==0 relative to this and you’re drawing the circle inside the sprite at position x==90. (therefore it begins at x==80).

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

Sidebar

Related Questions

I have a question about best practices regarding how one should approach storing complex
I have a strange (don't ask) need to see a few examples of a
I have this Task model: class Task < ActiveRecord::Base acts_as_tree :order => 'sort_order' end
I have a task and I want to generate some code using the CodeDom.
I have a Task object that has a collection of Label objects ... in
I'm relatively new to Nant, what i'd like to do is have a task
I have a slow custom data source in a SSIS Dataa Flow Task.I have
Here's what I'm trying to do : I have an entity Task with a
For customer service week this year, I have the privileged task of creating a
I have a backroundrb scheduled task that takes quite a long time to run.

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.