Jump to content

Thoughts of a Beginner


lithander
 Share

Recommended Posts

Picking

 

I spawned some circles (myGame.createGeomSprite(100, 100).createCircle(10)) and rectangles ( myGame.createGeomSprite(100, 200).createRectangle(10, 10) ) and would like to be able to pick them up and move them around. I registered a onDown handler on the input and now I'd like to figure out which of my object is under the mouse if any.

 

Only way I found out to do this is to call "geoSprite.circle.containsPoint" on all circles and "geoSprite.rect.containsPoint" on all rectangles. However the way I'd intuitively set it up I wouldn't know wether the object is a rect a circle or something else entirely and expect the object or some other part of the framework to handle the picking for me. If that's implemented somewhere I haven't found it yet.

Link to comment
Share on other sites

Picking II

 

myGame.createGeomSprite(100, 100).createCircle(100) creates a Circle that is centered at p(100,100) while myGame.createGeomSprite(100, 100).createRectangle(100, 100) creates a Rectangle that starts at p(100,100) and is centered at p(150,150) weird.

 

Also picking using the above mentioned contains() on the rect works as expected while the circle's does not. The circle is only pickable in it's west-north quadrant.

Link to comment
Share on other sites

Nice idea for a thread, thank you. By all means keep on experimenting and posting, but all of the things mentioned so far are fixed in the 1.0 release I'm working on like mad, including proper interaction support (click, tap, drag, drop, snapping) oh and I fixed the circle offset issue too :) By default Sprites are not going to be input enabled, you have to turn that on, but once done they'll interact to the mouse or any touch event.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...