khleug35

Members
  • Content Count

    119
  • Joined

  • Last visited

  • Days Won

    2

khleug35 last won the day on April 30

khleug35 had the most liked content!

About khleug35

  • Rank
    Advanced Member

Profile Information

  • Location
    Hong Kong

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello EveryOne How to get the TextureFrame number on Animation?? Thanks you very much this.sheet = new game.SpriteSheet('panda.png', 150 ,111); this.sprite = new game.Animation(this.sheet.textures); this.sprite.addAnim('attack', [43,44,45,46,47,48], { speed: 12, loop: false }); if(this.sprite.xxxxxxxxx.textureframe == 46){ // // dosomething....... } My solution is that, but I don't know Is it the best way to solve the problem?? Thanks if(this.sprite.currentAnim == this.sprite.anims['attack']){ for(var i =0; i < this.sprite.anims.attack.textures.length;i++){ if(i ===4){ // [43,44,45,46,47,48] = [0,1,2,3,4,5,6] due to I want to get frame 46, so i type 4. //doSomething } } } It is very easy to get the TextureFrame in Phaser 3, How about Panda2, Thank you //Phaser 3 if (this.sprite.anims.currentFrame.textureFrame === 46){ // dosomething }
  2. Thanks , One more question Is p2 plugin in Panda2 is not support direction of collision?? eg collide(body, dir) ?? collide: function(body, dir) { if (dir === 'UP' || dir === 'DOWN') { dosomething.... } } https://www.panda2.io/docs/api/Body
  3. khleug35

    p2.js plugin

    P2.js very very very powerful Physics Engines!!!!!!!!!
  4. @Stephan Hello, Thank you very much It work for me, I am Newbie for P2.js , I haven't set this code in Main scene Thank again!!!!!!!! Have a nice day
  5. I find the p2 example and try to type the following code to set player to Player collisionGroup and enemy to Enemy collisionGroup But I still no idea to check two object overlap and collision this.groups = { Player: Math.pow(2, 0), Enemy: Math.pow(2, 1), GROUND: Math.pow(2, 2) }; this.shape.collisionGroup= game.scene.groups.Player; this.shape.collisionMask= game.scene.groups.Player | game.scene.groups.Enemy; From Panda2 in Arcade Physics , I can try this method game.createClass('Player', { init: function() { ... this.body.collideAgainst = [game.Body.Enemy]; this.body.collide = this.collide.bind(this); }, collide: function(other) { if (other.collisionGroup === game.Body.Enemy) { //doSomething...... } }, ..... }); From phaser 2 in P2 Physics , I can refer to this link. http://www.phaser.io/examples/v2/p2-physics/collision-groups How about Panda2 in P2 Physics , Thank you very much
  6. How to detect collision between two objects in P2 Plugin?? I try to use the following code, but not work When collisionGroup 0 collide collisionGroup 1, It will trigger events (eg: hurt, tint, heart HP etc......) this.body.collisionGroup = 0; this.body.collideAgainst = [1]; this.body.collide = this.collide.bind(this); collide: function(body){ if (body.collisionGroup === 1) { console.log("You touch something"); } }, Anyidea check collision between two objects or check overlap in P2 Physics??? Thank you very much My full code of player class: game.createClass('Player', { init: function(x, y) { this.classname = 'playerclass'; this.sprite = new game.Sprite('panda.png'); this.sprite.position.set(x, y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.stage); this.body = new game.Body({ mass: 1, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var shape = new p2.Circle({ radius: this.sprite.width / 2 / game.scene.world.ratio }); /* For Box var shape = new p2.Box({ width: this.sprite.width/ game.scene.world.ratio, height: this.sprite.height/ game.scene.world.ratio }); */ this.body.addShape(shape); this.body.collisionGroup = 0; this.body.collideAgainst = [1]; this.body.addTo(game.scene.world); this.body.collide = this.collide.bind(this); }, collide: function(body){ if (body.collisionGroup === 1) { console.log("You touch something"); } }, update: function(){ this.sprite.position.x = this.body.position[0] * game.scene.world.ratio; this.sprite.position.y = this.body.position[1] * game.scene.world.ratio; this.sprite.rotation = this.body.angle; if (game.keyboard.down('W')) { this.body.velocity[1] = -2; } else if (game.keyboard.down('S')) { this.body.velocity[1] = 2; }else{ } if (game.keyboard.down('A')) { this.body.velocity[0] = -1; } else if (game.keyboard.down('D')) { this.body.velocity[0] = 1; } else { this.body.velocity[0] = 0; } } });
  7. Your game assets also can access for everyone
  8. Nice Game good work!!!!!!!
  9. @Wolfsbane Thank you for your playing Yes, This game no sound at present, I will add sound soon hope you enjoy it
  10. Hello Everyone. My new HTML5 shoot em up game made using Panda2 This game can play on mobile or desktop, but this game is no sound yet. Special thanks to @enpu, @Stephan and @Wolfsbaneteaching me coding skill, really thanks This game can play on mobile or desktop Try the game in here , hope you enjoy: https://superfranco.itch.io/space-shooterjh Android Version: Google Store Link ScreenShot: How to Play? For desktop control W key - Up A key - Left D key - Right S key - Down P Key - Pause the Game Space - use subweapon For Mobile control You can control the ship movement with JoyStick Click or press the icon to use subweapon and Pause the game. You can destroy the enemy and get money to buy a new ship and upgrade them. Mega Bomb - Mega Bombs damage and clears all forms of the enemy from the screen. When upgraded to level 3 or above,it can also clear enemy gunfire or bullet. Laser - Laser allows you to deal massive damage onto your enemies. Energy Shield - Energy Shield can protect player, When upgraded, it improves the duration of the shield. Mobile version. Android This is a classic vertically scrolling space shoot 'em up game. It has 9 levels with Easy and Hard unlocking regimen. The Hard mode can make double the amount of stars as your reward. You can go to store to upgrade your ship and buy a new ship. How to play -Control the ship movement with JoyStick -Click the icon to use subweapon and Pause the game. Item- Coin - Dropped from enemies , you can take this to upgrade your ship and buy a new ship. Health - Heals 20% of your ship. Subweapon item - increase one Subweapon amount of use. SupWeapon Mega Bomb - Mega Bombs damage and clears all forms of enemy from the screen. When upgraded to level 3 or above,it can also clears enemy gunfire or bullet. Laser - Laser allows you to deal massive damage onto your enemies. Energy Shield - Energy Shield can protect player, When upgraded, it improves the duration of the shield. Ship upgrades are Attack -power of bullets from main cannon. Speed - speed of ship. Health - endurance of the ship. SupWeapon - increase your SupWeapon power or improves the duration of the shield. If you clear all the stage with Hard mode. You are successful to complete the game. Made With: https://www.panda2.io/
  11. @Stephan Awesome !!! it work!!!!! Thank you very much for the awesome code and teaching me!!!  Have a nice day!!! Thanks again!!!
  12. @taoprox Thank you for a reply and remind, my apologies for misspelling but I using 'paused' now and not work : (
  13. How to check if the timer is paused?? the following is my example code game.createScene('Main', { init: function() { this.animation = game.Timer.add(100, function() { //dosomething }, true); this.animation.pause(); }, I try to using "this.animation.pasued", but not work update: function() { if(this.animation.pasued){ //check if the timer is paused, but not work this.animation.resume(); } any idea??? Thank you very much.
  14. Thanks for this!!!!!!!! you are an absolute legend! I love this. I will build 3D game for my third panda2 game