Skip to main content
Known Participant
July 18, 2022
Answered

Snap to all targets (Drag and drop game Animate CC HTML5 Canvas)

  • July 18, 2022
  • 1 reply
  • 338 views

Hi,

I created a drag and drop game in Animate CC with HTML5 canvas. How to make an object (red box) snaps to targets (white boxes)? It's not just snaps on correct target but also incorrect target, then shows response (correct or incorrect).

Best regard..

    This topic has been closed for replies.
    Correct answer kglad

    assuming all have the same center registration point and (target_mc is defined)

     

    this.redbox.x = this.redbox.target_mc.x;

    this.redbox.y = this.redbox.target_mc.y;

     

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    July 18, 2022

    assuming all have the same center registration point and (target_mc is defined)

     

    this.redbox.x = this.redbox.target_mc.x;

    this.redbox.y = this.redbox.target_mc.y;