lars

Members
  • Content Count

    61
  • Joined

  • Last visited

Posts posted by lars


  1. Hello 

    Im trying to make my spine object interactive:

     

      var player = new game.Spine('mySpine.json');
                //player.hitArea = new game.Rectangle(200, 500);
                player.position.set(300, 800);
                player.interactive = true;
    
                player.play('idle', true);
                //player.speed = 0.01
                player.addTo(this.stage);
    
    
                player.click = function() {
                    console.log('check clicked');
                };

    That did not work. I tried to put it in a container. That did not help either. It works OK an a sprite object.


  2. Hello 

    First of all. I m so glad to see Panda on the road again :-) I have just bought the full version and playing around with Spritesheets developed in Spine 3.6.52 professional. It seems like mesh is not supported in panda 2 version 1.5.0. When I export from spine as a spritesheet with mesh animations it won´t show the spritesheet, If i remove the Mesh animation it shows the animation fine:

     

    game.module(
        'game.main'
    )
    
    .require(
        'plugin.spine'
    )
        
    .body(function() {
        
        //game.addAsset('panda.png');
        
    game.addAsset('sheep.atlas');
    game.addAsset('sheep.json');
    
    game.createScene('Main', {
        init: function() {
            
            var player = new game.Player();
            player.sprite.addTo(this.stage);
            
        }
    });
    
    game.createClass('Player', {
        init: function() {
            
          
            
            //this.sprite = new game.Sprite('panda.png');
            
             this.sprite = new game.Spine('sheep.json');
            this.sprite.position.x = 200;
            this.sprite.position.y = 800;
            this.sprite.play('idle', true);
            
            
            
        }
    });
    
    });

     


  3. Hello Enpu

    So f...... nice to have you back :-) . It´s working now. Thanks a lot ...  

    Heres how I did (just a dummy, with some stolen parts), and put a reference in the config.js file as you said :-) :

    game.config = {
        system: {
            width: 1024,
            height: 768,
            center: true,
            scale: true,
            loader: 'MyLoader'
        }
    };
    

    And the dummy loader: 

    game.module(
        'game.main'
    )
    
    
    .require(
        'game.assets'
    )
    
    .body(function() {
    
        this.bar;
    
        game.createClass('MyLoader', 'Loader', {
            onStart: function() {
    
                this.bar = new game.Graphics();
    
                this.bar.beginFill('#ccc');
                this.bar.drawRect(0, 0, 260, 40);
    
                this.bar.x = game.system.width / 2 - (260 / 2);
                this.bar.y = game.system.height / 2 - (40 / 2);
                this.bar.scale.x = this.percent / 100;
                this.bar.addTo(this.stage);
    
            },
    
            onProgress: function() {
    
                console.log(this.percent);
                //console.log(this.sprite.x);
                this.bar.scale.x = this.percent / 100;
    
            },
    
            onComplete: function() {
    
                game.system.setScene('Main');
            }
        });
    
        game.createScene('Main', {
            backgroundColor: '#666',
    
            init: function() {
    
                console.log('opo');
    
    
            }
    
    
        });
    
    
    
    
    
    });

     


  4. I have tried with a panda 2 update version from: https://github.com/ekelokorpi/panda-engine/tree/develop/src

    And tried the following: 

    game.module(
        'game.main'
    )
    .body(function() {
    
    game.addMedia('baggrund_level1.png','bb');
    
        
    game.createScene('Main', {
        backgroundColor: '#666',
    
        init: function() {
    
    
       console.log('im started');
      this.loader = new game.Loader();
     this.loader.onStart = this.setGame.bind(this);
     this.loader.onProgress = this.setPercentGame.bind(this);
     this.loader.onComplete = this.loadingGame.bind(this);
     this.loader.start();
    
    
    
            
        },
    
           setGame: function() {
               console.log('Started'); 
            },
    
             setPercentGame: function() {
               console.log('percent'); 
            },
    
            loadingGame: function(){
                
            var sprite = new game.Sprite('bb');
            sprite.addTo(this.stage);
     }
    
     
    });
    
    });

    With the same result. No response from the onProgress listener. 


  5. Hello Enpu

    Yes I have a assets.js which holding the following:

    game.module(
        'game.assets'
    )
        .body(function() {
    
            game.addAsset('newgra/tastatur.jpg', 'tastatur');
            game.addAsset('newgra/uden-tastatur.jpg', 'uden-tastatur');
            game.addAsset('newgra/aeggeskilt.png', 'level1');
            game.addAsset('newgra/aeggeskilt.png', 'level2');
            game.addAsset('newgra/aeggeskilt.png', 'level3');
    
            game.addAsset('newgra/forgrund.png', 'bord');
            game.addAsset('newgra/baggrund.png', 'stribes');
            game.addAsset('newgra/bg-himmel.jpg', 'heaven');
        
            game.addAsset('newgra/baggrund_level1.png', 'baglevel1');
            game.addAsset('newgra/baggrund_level2.png', 'baglevel2');
            game.addAsset('newgra/baggrund_level3.png', 'baglevel3');
         
            game.addAsset('newgra/rabbit.json');
    
            game.addAsset('newgra/kylling.json');
            game.addAsset('newgra/fox.json');
    
            game.addAsset('newgra/smallchicken.json');
            game.addAsset('newgra/chickenweapon.json');
    
            game.addAsset('newgra/eggglow.json');
            game.addAsset('newgra/eggglow_blue.json');
            game.addAsset('newgra/eggglow_purple.json');
    
            game.addAsset('newgra/plane.json');
            game.addAsset('newgra/cheep.json');
            game.addAsset('newgra/chickenbaloonfly.json');
    
            game.addAsset('newgra/gennemfoert-lvl1.jpg', 'level1done');
            game.addAsset('newgra/gennemfoert-lvl2.jpg', 'level2done');
            game.addAsset('newgra/gennemfoert-lvl3.jpg', 'level3done');
    
            game.addAsset('newgra/shitbullet.png', 'bullets');
            game.addAsset('newgra/karamel.png', 'bigagurk');
          
    
            game.addAsset('newgra/karamel_small.png', 'peachs');
            game.addAsset('newgra/karamel2_small.png', 'peachs2');
            game.addAsset('newgra/karamel3_small.png', 'peachs3');
            game.addAsset('newgra/karamel4_small.png', 'peachs4');
            game.addAsset('newgra/sun.json');
    
            game.addAsset('newgra/eggs/aeg1-1.png', 'sam1');
            game.addAsset('newgra/eggs/aeg1-2.png', 'sam2');
            game.addAsset('newgra/eggs/aeg1-3.png', 'sam3');
            game.addAsset('newgra/eggs/aeg-2-1.png', 'sam4');
            game.addAsset('newgra/eggs/aeg-2-2.png', 'sam5');
            game.addAsset('newgra/eggs/aeg-2-3.png', 'sam6');
            game.addAsset('newgra/eggs/aeg3-1.png', 'sam7');
            game.addAsset('newgra/eggs/aeg3-2.png', 'sam8');
            game.addAsset('newgra/eggs/aeg3-3.png', 'sam9');
    
            game.addAsset('newgra/eggs/aeg1-1-mini.png', 'sam1-mini');
            game.addAsset('newgra/eggs/aeg1-2-mini.png', 'sam2-mini');
            game.addAsset('newgra/eggs/aeg1-3-mini.png', 'sam3-mini');
            game.addAsset('newgra/eggs/aeg-2-1-mini.png', 'sam4-mini');
            game.addAsset('newgra/eggs/aeg-2-2-mini.png', 'sam5-mini');
            game.addAsset('newgra/eggs/aeg-2-3-mini.png', 'sam6-mini');
            game.addAsset('newgra/eggs/aeg3-1-mini.png', 'sam7-mini');
            game.addAsset('newgra/eggs/aeg3-2-mini.png', 'sam8-mini');
            game.addAsset('newgra/eggs/aeg3-3-mini.png', 'sam9-mini');
    
            game.addAsset('newgra/button-left.png', 'jump');
            game.addAsset('newgra/button-right.png', 'shooting');
    
            game.addAsset('particle.png', 'particle');
            game.addAsset('testfont.fnt');
    
            game.addAudio('sound/waterdrop.*', 'water');
            game.addAudio('sound/fruit.*', 'fruit');
            game.addAudio('sound/newsound/baggrund_paaskespil.*', 'bb');
            game.addAudio('sound/newsound/baggrund_paaskespil2.*', 'bb2');
            game.addAudio('sound/newsound/baggrund_paaskespil3.*', 'bb3');
    
            game.addAudio('sound/newsound/Fail_0.*', 'fail0');
            game.addAudio('sound/newsound/Fail_1.*', 'fail1');
            game.addAudio('sound/newsound/Fail_2.*', 'fail2');
    
            game.addAudio('sound/newsound/done_level1.*', 'goal1');
            game.addAudio('sound/newsound/done_level2.*', 'goal2');
            game.addAudio('sound/newsound/done_level3.*', 'goal3');
    
            game.addAudio('sound/newsound/first_course.*', 'hint4');
    
            game.addAudio('sound/newsound/airplane.*', 'airplane');
            game.addAudio('sound/newsound/sheep.*', 'sheepsound');
        
            game.addAudio('sound/newsound/biplane.*', 'biplane');
    
            game.addAudio('sound/newsound/collectegg.*', 'collectegg');
            game.addAudio('sound/newsound/shoot.*', 'shoot');
            game.addAudio('sound/newsound/shoot1.*', 'shoot1');
            game.addAudio('sound/newsound/shoot2.*', 'shoot2');
        
            game.addAudio('sound/newsound/fanfare.*', 'fanfare');
    
    
    
    
        });

     


  6. Hello everyone

    I´m having some issues with the Loader in Pandajs 2

    When i do the following:

     this.loader.onStart = this.setGame.bind(this);
     this.loader.onComplete = this.loadingGame.bind(this);
     this.loader.start();

        Everything is just fine:

    But when I try to make a onProgress the onProgress does not response:

     this.loader.onStart = this.setGame.bind(this);
     this.loader.onProgress = this.processGame.bind(this);
     this.loader.onComplete = this.loadingGame.bind(this);
     this.loader.start();

    I can see it, and trace it in the Loader.js class :

    onProgress: function() {
     //console.log(this.percent);
    //if (this.barFg) this.barFg.scale.x = this.percent / 100;
        }

    Her is a simple implementation I done:

    game.module(
        'game.start'
    
    )
    
    .require(
         'game.assets'
    
     )
    
    
    .body(function() {
    
        game.createScene('Start', {
            backgroundColor: '#5ca282',
    
            init: function() {
                
             
      this.loader = new game.Loader();             
                
     this.loader.onStart = this.setGame.bind(this);
     this.loader.onProgress = this.processGame.bind(this);
     this.loader.onComplete = this.loadingGame.bind(this);
     this.loader.start();
    
      }, //END init
    
              setGame: function() {
               console.log('started'); 
            },
            
              processGame: function() {
               console.log('percent'); 
            },
            
          
            
    
            loadingGame: function() {
    
                document.getElementById('loading').style.display = "none";
    
                this.startContainer = new game.Container().addTo(this.stage);
    
    
                if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                    this.mytastatur = new game.Sprite('tastatur').addTo(this.startContainer);
    
    
    
    
    
                } else {
    
                    this.mytastatur = new game.Sprite('uden-tastatur').addTo(this.startContainer);
    
                }
    
                this.mytastatur.position.x = game.system.width / 2 - this.mytastatur.width / 2;
                this.mytastatur.position.y = 0;
                this.mytastatur.interactive = true;
                this.mytastatur.click = this.mytastatur.tap = this.changeScene.bind(this, "Main");
    
            },
    
    
            changeScene: function(go) {
    
    
                game.system.setScene(go);
                var playbg = game.audio.playMusic('bb', true);
                game.audio.setVolume(playbg, 0.2);
    
            },
    
    
    
    
        }) //END Start
    
    
    
    });

    Anybody knows what wrong with onProgress on the Loader.

    /Lars


  7. Hello everyone

    Hope someone could help me with the following:

    this.loader = new game.Loader();
    
     this.loader.onComplete = this.loaded.bind(this);
                    this.loader.onProgress=this.onProgress.bind(this);
                     this.loader.start();
    
    

    Its the onProgress which not is working. I´ll tried:

     this.loader.onProgress(this.onProgress.bind(this));

    Heres how i call my assets:

    game.module(
         'game.main'
     )
    
     .require(
         'game.assets',
         'game.objects',
         'game.settings',
         'game.start',
         'game.level2',
      
     )

     


  8. Hey

     

    Having trouble removing my body from an event

    game.createClass('ChristmasPackage', {            init: function(myimg,myscale) {                var myPumkingsVelocityArray = [100, 80, 60, 50, 40, 32, 45, 67, 78, 98, 90];                var pumkingVInterval = myPumkingsVelocityArray[Math.floor(Math.random() * myPumkingsVelocityArray.length)];                var x = Math.random(16, game.system.width);                this.pumkins = new game.Sprite(myimg);             this.pumkins.interactive=true;                this.pumkins.anchor.set(0.5, 0.5);                 this.pumkins.scale.set(myscale, myscale);                this.body = new game.Body({                    position: {                        x: x,                        y: -this.pumkins.height                    },                    velocity: {                        x: 0,                        y: pumkingVInterval                    },                    collisionGroup: 1,                    collideAgainst: [0],                    mass: 0,                });                this.body.collide = this.collide.bind(this, myimg);                var shape = new game.Rectangle(90, 90);                this.body.addShape(shape);                game.scene.stage.addChild(this.pumkins);                game.scene.world.addBody(this.body);                game.scene.addObject(this);                               

     This is the function where i try to remove the body

                                    this.pumkins.click = this.pumkins.tap = function(e) {                       game.scene.world.removeBody();       //this.body.remove();             };//function end               }

    Can anyone help me here ... :-)


  9. I have the following:

     

    this.countDownText = new game.PIXI.Text("allo", { font: '40px Verdana',fill:'white'});        this.countDownText.position.set(20, 10);        this.stage.addChild(this.countDownText);                         this.ShootTimer = game.scene.addTimer(1000, this.countdown.bind(this), true);            this.countdown();  
     
     
    and try to pause ShootTimer when it´s meets a condition:
     
    countdown: function() {                           if(this.countingDown  < 50){                    this.ShootTimer.pause();                     console.log("im there");//dette virker  }                      this.countingDown --;         this.countDownText.setText(this.countingDown.toString());  }

    But it does not pause. Any ideas :-)

     
     

  10. Sorry found a solution:

     

     
    this.scoreText = new game.PIXI.Text("allo", { font: '60px Verdana' });        this.scoreText.position.set(game.system.width - 20, 10);        this.addScore(0);        this.stage.addChild(this.scoreText);                                     },                        addScore: function(amount) {        this.score += amount;        this.scoreText.setText(this.score.toString());    }

  11. Hello

     

    A simple Q:

     

    How can i make at globla reference to a text:

     

    I tryed to put this in my main scene:

     

    this.myCountdown = new game.PIXI.Text("allo", { font: '60px Arial' });
    this.stage.addChild(this.myCountdown);
    this.myCountdown.text="hello test";
     
    So I would like to refer to it in another obejct:
     
    this.myCountdown.text=counter;

  12. Hey enpu

     

    Thank´s a lot for the answer. 

     

    Have tried to update to v2. that gave me some trouble with the fromeFrame texture:

     

     this.sprite = game.Animation.fromFrames('stand');            this.sprite.animationSpeed = this.speed;            this.sprite.anchor.set(0.5, 0.5);            this.sprite.play();            this.runTextures = this.sprite.textures;            this.moveUpTextures = [game.Texture.fromFrame('ninjaup.png')];            this.moveLeftTextures = [game.Texture.fromFrame('ninjaleft.png')];            this.moveRightTextures = [game.Texture.fromFrame('ninjaright.png')];

    did´t know how to solve this ... 

     

    have tried to install pandatool 1.12.3 and that did it... yahhhhhiii ... Thank´s alot ... Pandajs rules ... 


  13. Ok so far i have installed node.js and installed panda tool:

     

    $ sudo npm install -g pandatool

     

    and when I try to build with $ panda build I get the following error:

     

    Building project...

    /Applications/MAMP/htdocs/ninjaalien/src/game/.DS_Store:1

    (function (exports, require, module, __filename, __dirname) { 

                                                                  

     

    SyntaxError: Unexpected token ILLEGAL

        at exports.runInThisContext (vm.js:53:16)

        at Module._compile (module.js:414:25)

        at Object.Module._extensions..js (module.js:442:10)

        at Module.load (module.js:356:32)

        at Function.Module._load (module.js:311:12)

        at Module.require (module.js:366:17)

        at require (module.js:385:17)

        at Object.module.exports.exports [as build] (/usr/local/lib/node_modules/pandatool/build.js:62:9)

        at Object.<anonymous> (/usr/local/lib/node_modules/pandatool/panda.js:7:17)

        at Module._compile (module.js:435:26)


  14. I have tried to upload a simple demo of a game I have made. It says the it´s cant find the game.min.js:

     

    game.min.js Failed to load resource: the server responded with a status of 404 (Not Found)

     

    I haven¨t minified or packed the game (dont know how in panda)

     

     

    I would appreciate if someone could lead me in the right direction :-)

     
     
     
    I would appreciate
    I would appreciate
     
    I would appreciate
     
    I would appreciate

  15. Is there a way to say to a body:

    When I´m hit (collision detected) remove the collision detection.

    I starting a spritesheet animation whichs live in the hitted objects and the collision seems to continue when it´s still is colliding with a object. Or should I use at seperate sprite animation which´s is called when to object collide.

     

     


  16. Solution:

    Adding a timer ... before remove ... found in Spaceshooter Example ... 

    collide: function() {            this.pumkins.textures = this.poffedPumkins.textures;            this.pumkins.currentFrame = 0;            //In this case just run it once            this.pumkins.loop = false;            this.pumkins.onComplete = function() {                console.log("allo");          this.pumkins.visible = false;                            game.scene.addTimer(0, function() {              this.remove();}.bind(this));                                            }.bind(this);        },