luotuo

Members
  • Content Count

    8
  • Joined

  • Last visited

Posts posted by luotuo


  1. solved

    StatusBar.topContainer = this.add.container(0, this.sys.game.config.height - this.height);
            StatusBar.topContainer.setSize(this.sys.game.config.width, this.height);
            StatusBar.topContainer.key = "top_Container";
            StatusBar.topContainer.setInteractive();
            this.input.setDraggable(StatusBar.topContainer);
            //new Phaser.Geom.Rectangle(0, this.sys.game.config.height-this.height, this.width, this.height), Phaser.Geom.Rectangle.Contains
    
            this.tagUpdate("paper_0");
            this.scene.bringToTop();
    
    
            StatusBar.topContainer.on('mousemove', function(pointer, gameObject) {
    
                console.log('gameobjectover ' + "topContainer");
    
            });
    
            StatusBar.topContainer.on('gameobjectout', function(pointer, gameObject) {
    
                console.log('gameobjectout ' + "topContainer");
    
            });
    
            StatusBar.topContainer.on('dragstart', function(pointer, gameObject) {
    
                console.log('dragstart ' + "topContainer");
    
            });
    
            StatusBar.topContainer.on('drag', function(pointer, gameObject, dragX, dragY) {
    
                console.log('drag ' + "topContainer");
    
            });
    
            StatusBar.topContainer.on('dragend', function(pointer, gameObject) {
    
                console.log('dragend ' + "topContainer");
    
            });
    
            StatusBar.topContainer.on('pointerover', function(pointer, gameObject) {
    
                console.log('pointerover ' + "topContainer");
    
            });
    
            StatusBar.topContainer.on('pointerout', function(pointer, gameObject) {
    
                console.log('pointerout ' + "topContainer");
    
            });
    

     


  2. This is my app, use phaser3.   the red line area is in one top container . I would like  the area move left  and right by user finger。

    A container   How to listen drag even? 

    AAAA.thumb.png.e9d039e323fd23a2ba645ed2086c178f.png

    This is my code,  but is not work.

    
            
           StatusBar.create = function() {
            this.events.on('resize', this.resize, this);
            this.buttomBanner();
            StatusBar.topContainer = this.add.container(0, this.sys.game.config.height - this.height);
            StatusBar.topContainer.setInteractive();
    
            StatusBar.topContainer.on("drag", function(pointer) {
    
               console.log("hit");
    
            });
    
            this.tagUpdate("paper_0");
            this.scene.bringToTop();
            
           
    
            
    
    
        }
    
            
    
    
        }

     


  3. On 7/10/2018 at 7:45 PM, enpu said:

    align property is used only on multi-line text, so you can remove that.

    To recenter you do have to set the x anchor after you change your text (because the width of the text changes), like this:

    
    this.countdownTxt.setText('9');
    this.countdownTxt.anchor.x = this.countdownTxt.width / 2;
    

     

    thanks you.