Great, that demo looks like what I need. I'll try it out in my project tonight. Thanks.
On Sep 24, 4:01 am, claudio canepa <[email protected]> wrote: > On Fri, Sep 24, 2010 at 1:06 AM, Mike Wyatt <[email protected]> wrote: > > I have a ScrollingManager with a RectMapLayer child (like the > > test_tiles.py test). On mouse press, I want to dispatch a > > "MoveToCell" event to a sprite. I need to determine which cell was > > clicked in the RectMapLayer based on the screen coordinates. > > get_at_pixel() seems useful, but the docs say it is in map coordinates > > "unmodified by screen, layer or view transformations". > > > Is there an easy way to retrieve this, or do I need to extract the > > modelview matrix from the layer and do the math myself? > > I think pixel_from_screen is what you want. > See this example, where the sprite will go to the mouse click > position:http://groups.google.com/group/cocos-discuss/web/test_ball_mouse_driv... > > You can look at cocos.actions.move actions and the associated test_tiles.py > for > an example on driving a sprite with actions. > > Naturally,it is also posible to control the sprite with the classic > class MySprite(...): > def update(self, dt): > your code > > which can be more flexible if you have complex animation code. > > -- > claudio -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
