开发者

intersects sprite and get currentTarget

开发者 https://www.devze.com 2023-02-03 14:49 出处:网络
I have create a few sprites consist of various music notes, when the cursor sprite move over to one of the notes, it would blink using intersect开发者_如何学C. I have no idea on how to make the cursor

I have create a few sprites consist of various music notes, when the cursor sprite move over to one of the notes, it would blink using intersect开发者_如何学C. I have no idea on how to make the cursor detect which note it overlap. Can anyone provide an example?


Try

getObjectsUnderPoint(stage.mouseX, stage.mouseY);

or

for each (var spr:Sprite in notes) {
  if (spr.hitTestPoint (stage.mouseX, stage.mouseY)) {
     // some code here
  }
}

These documentation pages might help: getObjectsUnderPoint, hitTestPoint

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号