[ad_1]
I’ve 3 sprites, with the assistance of a script I alter the rendering order and drag the sprites one on high of the opposite in reverse order.
The sprite that was on the backside is obtained from above. But if you click on on this stack once more, it isn’t attainable to take the highest sprite.
Please inform me how can I clear up this downside. I didn’t discover a resolution on the discussion board.
import { _decorator, Component, Node, enter, Input, Event, Vec2, Label, KeyCode, EventMouse, EventGoal} from ‘cc’;
import{GameManager} from “./GameManager”;
const { ccclass, property } = _decorator;
@ccclass(‘TouchDragger’)
export class TouchDragger extends Component {
onLoad() {
this.node.on(Node.EventKind.TOUCH_START, (occasion) => {
console.log('Touch begin');
occasion.propagationStopped = true;
this.node.setSiblingIndex(2);
}, this);
this.node.on(Node.EventKind.TOUCH_MOVE, (occasion) => {
this.node.setPosition(this.node.getPosition().x + occasion.contact.getDelta().x , this.node.getPosition().y + occasion.contact.getDelta().y, 0);
}, this);
this.node.on(Node.EventKind.TOUCH_END, (occasion) => {
console.log('Touch finish');
occasion.propagationStopped = false;
}, this);
}
[ad_2]