lundi 27 juin 2016

Cloning drag and drop, snap to grid

Im a beginner at ActionScript3 and Im trying to create a a game where by the user is able to duplicate an object using the drag and drop method, and is still able to reposition the duplicates that snap to grids-

Cube_1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
Cube_1.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler1);

function mouseDownHandler1(evt:MouseEvent):void {
    var object = evt.target;
}

function mouseUpHandler1(evt:MouseEvent):void {
    var obj = evt.target;
        obj.stopDrag();
}

I managed to find these codes but but Im unable to make it duplicate as Im unsure of how to go around doing so. Are there any ways I can improve on this?

Thankyou!

Aucun commentaire:

Enregistrer un commentaire