khleug35

Members
  • Content Count

    139
  • Joined

  • Last visited

  • Days Won

    3

Reputation Activity

  1. Like
    khleug35 reacted to Stephan in Is Panda 2 Dead?   
    Hi all,
     
    I just wanted to let you know that Panda is still my primary game engine and I have no plans to abandon Panda. The absence of @enpu is unfortunate but don't forget that Panda is open source so most of the time, it is possible to fix minor issues yourself by having a look in the source code. Currently I have two large commercial projects powered by Panda and it is expected that these project will be running for at least several years.
    Don't forget that Panda by itself is a great engine and that it has a couple of features that not all other engines currently are supporting. Take hires support and the custom Panda GUI for example, these are just great!
    I will continue to read this forum on a regular basis. If there are questions that I can answer quickly, you can count on my support.
     
    Stephan
     
  2. Like
    khleug35 got a reaction from Nagval333 in Ropes Game   
    @AlienBurn
    recommend you try both and see which one suits you.
    For me
    Panda 
    -Easy to learn, I have three games made with panda.
    -Very small community.
    -Panda Editor is not free but it can make you code your game faster(export to web or mobile is easy). 
    -Growth So Slow, Engine has not updated for a long time, I worried that it like impact.js.
       
    Phaser
    -Much tutorial and Demo Example (but it left me quite confused after looking at multiple tutorials and even trying a few test projects.) 
    -Very large community.
    -if you want to export to mobile and Code obfuscation, You need to learn cordova/phonegap , Webpack etc….it's totally free
    -Engine keep updated each month, fast-growing. 
    Finally, Both of them are an awesome HTML5 engine.😁 
  3. Like
    khleug35 got a reaction from Nagval333 in Ropes Game   
    Fling, Tap and hold to swing on yellow Circle and collect the hearts attain request the target amount.
    Flip tiger laughing like a spiderman.
    Play Here
    https://superfranco.itch.io/ropes-game

    Android Version:
    https://play.google.com/store/apps/details?id=io.game.ropesgame

     
    How to Play:
    -Tap and hold to swing on yellow Circle.
    -Collect the hearts until attaining request the target amount within a limited time.
    -Avid the Bomb
    -Complete all 12 Levels

     
    Credit:
    Graphic Download By:  
    CraftPix.net  https://craftPix.net
    OpenGameArt   https://opengameart.org/
    Music By bart:
    https://opengameart.org/content/jump-and-run-tropical-mix
    Inspiration:
    https://triqui.itch.io/gems-n-ropes
    Engine:
    Panda2 
    P2.js
  4. Like
    khleug35 got a reaction from cpu_sam in Ropes Game   
    @AlienBurn
    recommend you try both and see which one suits you.
    For me
    Panda 
    -Easy to learn, I have three games made with panda.
    -Very small community.
    -Panda Editor is not free but it can make you code your game faster(export to web or mobile is easy). 
    -Growth So Slow, Engine has not updated for a long time, I worried that it like impact.js.
       
    Phaser
    -Much tutorial and Demo Example (but it left me quite confused after looking at multiple tutorials and even trying a few test projects.) 
    -Very large community.
    -if you want to export to mobile and Code obfuscation, You need to learn cordova/phonegap , Webpack etc….it's totally free
    -Engine keep updated each month, fast-growing. 
    Finally, Both of them are an awesome HTML5 engine.😁 
  5. Like
    khleug35 reacted to Ninjadoodle in My 2019 - 7 Day Game Challenge   
    Hi guys
    At the start of the year I've gave my self a challenge to make a game every 7 days
    It's been a rocky road and I've had a couple of ups and downs but I'm happy to have made 21 games so far.
    After having tried almost every engine under the sun, and listening to everyone telling me what I needed, I decided that coding wasn't for me and gave Construct 3 a go - I honestly couldn't be happier, as it's an amazing engine.
    If you're interested in checking my games out, you can play them all here ninjadoodle.com
    PS. For anyone interested, I also make gamedev / behind the scenes related videos, including game making tutorials - youtube/tomvencel
    Thank you!
  6. Like
    khleug35 reacted to enpu in Top Down Shooter Template   
    Really great work!
  7. Like
    khleug35 reacted to Wolfsbane in P2 Platformer Template   
    Niice to see! Played the demo, and I'll check the code out later.
    One thing is the brown wall jumping(vertical jumping) seems a bit glitchy? The player seems to blip away from the wall, rather than move smoothly.
    Yeah, I wanted to share a few demo too, but is a bit awkward if we can't include the plugin.
    I wonder if it's a good idea to have some kind of build option in the Panda Editor. I.e. so in the Editor, you can say 'include P2.js plugin'. The editor will check: If you have it locally, great, it'll use it. Otherwise, it will try to download it for you from the Panda website.
    This way, we can share our open-source projects that use plugins a bit easier? cc: @enpu 
     
  8. Like
    khleug35 got a reaction from Wolfsbane in Top Down Shooter Template   
    A Simple Game example of the 8-direction movement template created using the Panda engine. controlled with WSAD keys. The User can shoot bullets by Mouse clicking.
    Demo Game
    Full Game Download:
    https://github.com/SuperFranco16/TopDownShooter_Panda2_Template

    Features:
    -Press WASD to move
    -Press P Pause the Game
    -Mouse to aim and shoot bullets
    Notes:
    -This template is not created by enpu, so my code maybe not good or more hardcode or not the best solution to achieve , Welcome to give me a feedback to improve my coding skill, Thanks
    -Game asset download from https://opengameart.org/users/rileygombart , https://opengameart.org/content/top-down-sci-fi-shooter-pack
    Full Code: main.js
    game.module( 'game.main' ) .body(function() { game.addAsset('bg.jpg'); game.addAsset('player.png'); game.addAsset('player_bullet.png'); game.addAsset('Enemy.png'); game.addAsset('explosion.png'); game.createScene('Main', { init: function() { var ths = this; this.world = new game.Physics(0, 0); this.container = new game.Container(); this.container.addTo(this.stage); //BackGround this.bg = new game.Sprite('bg.jpg').addTo(this.container); //Player this.player = new game.Player(200, 300); //Enemy game.Timer.add(1500, function() { new game.Enemy(Math.floor(game.scene.player.body.position.x + (Math.random(Math.random(-1000, -600),Math.random(600, 1000)))), game.scene.player.body.position.y + (Math.random(-800, 800))); }, true); // Left wall new game.Wall(0, 810, 30, 1650); // Right wall new game.Wall(2060, 810, 30, 1650); // Top wall new game.Wall(1030, 0, 2060, 30); // Bottom wall new game.Wall(1030, 1640, 2060, 30); //BackScreen this.blackscreen = new game.Graphics(); this.blackscreen.fillColor = '#000000'; this.blackscreen.alpha = 0; this.blackscreen.drawRect(0, 0, game.width, game.height); //Score, When you kill the enemy, you get 10 score. this.score = 0; this.scoretxt = new game.SystemText('Score : ' + this.score); this.scoretxt.size = 36; this.scoretxt.color = '#fdfdfd'; this.scoretxt.position.set(16, 0); this.scoretxt.addTo(this.stage); //How To Play new game.Dialogue(16, 50, '-Press WASD to move'); new game.Dialogue(16, 80, '-Press P Pause the Game'); new game.Dialogue(16, 110, '-Mouse to aim and shoot'); //Camera Follow Player this.camera = new game.Camera(this.player.sprite); this.camera.position.set(this.player.sprite); this.camera.limit.x = 0; this.camera.limit.y = 0; this.camera.limit.width = game.width - 500; this.camera.limit.height = game.height + 200; this.camera.acceleration = 20; this.camera.addTo(this.container); }, keydown: function(key) { if (key === 'P') { if (this.paused) { this.resume(); this.blackscreen.remove(); } else { this.pause(); this.blackscreen.addTo(this.stage); this.blackscreen.alpha = 0.5; } } }, update: function() {} }); game.createClass('Player', { selectTime: true, speed: 400, init: function(x, y) { var ths = this; this.sprite = new game.Sprite('player.png'); this.sprite.anchorCenter(); this.sprite.position.set(x, y); this.sprite.addTo(game.scene.container); this.body = new game.Body(); this.body.collisionGroup = game.Body.PLAYER; this.body.collideAgainst = [game.Body.WALL, game.Body.ENEMY]; this.body.position.set(x, y); var shape = new game.Rectangle(this.sprite.width / 2.5, this.sprite.height / 2.5); this.body.addShape(shape); this.body.addTo(game.scene.world); this.body.collide = this.collide.bind(this); this.worldPosition = new game.Vector(); }, play: function(anim) { if (this.sprite.currentAnim === this.sprite.anims[anim]) return; this.sprite.play(anim); }, collide: function(body) { if (body.collisionGroup === game.Body.ENEMY) { return false; } return true; }, shoot: function() { var bullet = new game.playerbullet('player_bullet.png', 0, 0, this.sprite.position.x, this.sprite.position.y); bullet.addTo(game.scene.container); var angle = game.input.mouse.angle(this.worldPosition); bullet.rotation = angle - Math.PI / 2; bullet.body.velocity.x = 2000 * Math.cos(angle - Math.PI); bullet.body.velocity.y = 2000 * Math.sin(angle - Math.PI); this.sprite.swap(bullet); }, reset: function(speed) { var ths = this; this.selectTime = false; if (!this.selectTime) { game.Timer.add(speed, function() { ths.selectTime = true; }); } }, update: function() { if (game.scene.isMouseDown && this.selectTime) { this.shoot(); this.reset(300); } this.worldPosition.copy(this.sprite.position); this.worldPosition.subtract(game.scene.camera.position); var angle = game.input.mouse.angle(this.worldPosition); this.sprite.rotation = angle - Math.PI / 2; if (game.keyboard.down('A')) { this.body.velocity.x = -this.speed; } else if (game.keyboard.down('D')) { this.body.velocity.x = this.speed; } else { this.body.velocity.x = 0; } // Set y velocity based on up and down keys if (game.keyboard.down('W')) this.body.velocity.y = -this.speed; else if (game.keyboard.down('S')) this.body.velocity.y = this.speed; else this.body.velocity.y = 0; /* this.sprite.rotation= this.sprite.position.angle(game.scene.circle2.position); */ this.sprite.position.x = this.body.position.x; this.sprite.position.y = this.body.position.y; } }); game.createClass('Enemy', { immortal: false, alive: true, health: 3, speed: 400, selectTime: true, init: function(x, y) { var ths = this; // Play animation this.sprite = new game.Sprite('Enemy.png'); this.sprite.anchorCenter(); this.sprite.position.set(x, y); this.sprite.addTo(game.scene.container); this.body = new game.Body(); this.body.collisionGroup = game.Body.ENEMY; this.body.collideAgainst = [game.Body.PLAYER, game.Body.PLAYERBULLET]; this.body.position.set(x, y); var shape = new game.Rectangle(this.sprite.width / 2, this.sprite.height / 2); this.body.addShape(shape); this.body.addTo(game.scene.world); this.body.collide = this.collide.bind(this); this.removeTimer = game.Timer.add(8000, this.remove.bind(this)); }, play: function(anim) { if (this.sprite.currentAnim === this.sprite.anims[anim]) return; this.sprite.play(anim); }, collide: function(body) { if (body.collisionGroup === game.Body.PLAYERBULLET) { this.hurt(); return false; } return true; }, hurt: function() { var ths = this; if (this.immortal == false) { this.immortal = true; this.health--; var ths = this; this.sprite.tint = '#ffffff'; game.Timer.add(100, function() { ths.sprite.tint = ''; ths.immortal = false; }); } }, remove: function() { this.body.remove(); this.sprite.remove(); game.scene.removeObject(this); }, dead: function() { var ths = this; if (this.health <= 0) { if (this.alive) { this.alive = false; game.scene.score = game.scene.score + 10; game.scene.scoretxt.text = 'Score : ' + game.scene.score; var explosion = new game.Explosion(this.body.position.x, this.body.position.y); explosion.sprite.addTo(game.scene.container); this.remove(); } } }, reset: function(speed) { var ths = this; this.selectTime = false; if (!this.selectTime) { game.Timer.add(speed, function() { ths.selectTime = true; }); } }, update: function() { this.dead(); this.sprite.rotation = this.body.position.angle(game.scene.player.body.position) + .1; var e = this.sprite.position.angle(game.scene.player.sprite.position); this.body.velocity.x = Math.cos(e) * 300, this.body.velocity.y = Math.sin(e) * 300; this.sprite.position.x = this.body.position.x; this.sprite.position.y = this.body.position.y; } }); game.createClass('playerbullet', 'PhysicsSprite', { // How fast playerbullet moves (pixels in second) init: function(texture, width, height, x, y) { this.anchorCenter(); this.body.position.set(x, y); this.body.collisionGroup = game.Body.PLAYERBULLET; this.body.collideAgainst = [game.Body.ENEMY]; }, collide: function(body) { this.remove(); }, remove: function() { // Extend remove function to also remove object from scene // So it's update function doesn't get called anymore this.super(); game.scene.removeObject(this); }, update: function() { // Remove playerbullet if out of screen if (!this.onScreen()) this.remove(); } }); game.createClass('Explosion', { init: function(x, y) { var ths = this; this.sheet = new game.SpriteSheet('explosion.png', 256, 256); this.sprite = new game.Animation(this.sheet.textures); this.sprite.addAnim('doexplode', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], { speed: 30, loop: false }); //Explosion animation completed, the boom will be destroyed this.sprite.anims.doexplode.onComplete = function() { ths.sprite.remove(); ths.body.remove(); game.scene.stage.removeChild(ths); }; this.sprite.anchorCenter(); this.sprite.position.set(x, y); this.sprite.play('doexplode'); this.body = new game.Body(); this.body.mass = 0; this.body.position.set(x, y); var shape = new game.Rectangle(this.sheet.width, this.sheet.height); this.body.addShape(shape); this.body.addTo(game.scene.world); }, play: function(anim) { if (this.sprite.currentAnim === this.sprite.anims[anim]) return; this.sprite.play(anim); } }); game.createClass('Wall', { init: function(x, y, width, height) { this.body = new game.Body(); var shape = new game.Rectangle(); shape.width = width; shape.height = height; this.body.position.x = x; this.body.position.y = y; this.body.addShape(shape); this.body.static = true; this.body.addTo(game.scene.world); } }); game.createClass('Dialogue', { init: function(x, y, txt) { this.text = new game.SystemText(txt); this.text.size = 25; this.text.color = '#fdfdfd'; this.text.position.set(x, y); this.text.addTo(game.scene.stage); } }); // Attributes for different body types game.addAttributes('Body', { WALL: 0, PLAYER: 1, PLAYERBULLET: 2, ENEMY: 3, ENEMYBULLET: 4 }); }); TopDownShooter.zip
  9. Like
    khleug35 got a reaction from Wolfsbane in P2 Platformer Template   
    A Simple Game example of platformer template created using the Panda2 engine + P2 plugin. 
    This Template is remade base on Construct 3 platformer template.
    Demo Game
    Download:(not include p2.js plugin)
    https://github.com/SuperFranco16/p2-platformer-template
    Features:
    -Arrow keys or WASD to move
    -P key to pause the game      
    -You can jump up across the brown walls


     
    Update(2019-9-18):
    Added Rope-Swinging Features:
    -Jump up and Press E to climb up the rope, when you see red circle.

    Notes:
    -This template is not created by enpu, so my code maybe not good or more hardcode or not the best solution to achieve , Welcome to give me a feedback to improve my coding skill, Thanks
    -P2 Plugin is not open source, so the download file is not include p2.js.
    Full Code: Main.js
    game.module( 'game.main' ) .require( 'plugin.p2' ) .body(function() { game.addAsset('player.png'); game.addAsset('BackgroundTile.png'); game.createScene('Main', { backgroundColor: '#272727', init: function() { var ths = this; this.world = new game.Physics({ gravity: [0, 12], }); this.world.on('beginContact', function(data) { // Before collision }); this.world.on('impact', function(data) { // Collision }); this.world.on('postStep', function(data) { // After collision }); //Group this.groups = { PlayerGroup: Math.pow(2, 0), PlayerGroupFilter: Math.pow(2, 1), GROUND: Math.pow(2, 2), }; this.container = new game.Container(); this.container.addTo(this.stage); //Map this.bg = new game.TilingSprite('BackgroundTile.png', game.width, game.height).addTo(this.container); new game.Wall_Platform(32, 96, 32, 672); new game.Wall_Platform(160, 384, 32, 224); new game.Wall_Platform(1247, 0, 64, 1023); new game.Slope_Solid_Platform(675, 310, 200, 32, 8.9); new game.Slope_Solid_Platform(619, 463, 365, 32, 9.6); new game.Slope_Solid_Platform(322, 392, 219, 32, 9.8); new game.Solid_Platform(32, 768, 352, 128); new game.Solid_Platform(864, 800, 96, 32); new game.Solid_Platform(992, 928, 128, 32); new game.Solid_Platform(1088, 736, 96, 32); new game.Solid_Platform(992, 928, 128, 32); new game.Solid_Platform(1088, 736, 96, 32); new game.Solid_Platform(480, 240, 96, 30); new game.Solid_Platform(528, 432, 96, 32); new game.Solid_Platform(192, 320, 96, 32); new game.Solid_Platform(0, -28, 1280, 28); new game.Solid_Platform(32, 768, 352, 128); new game.JumpThru_Platform(1056, 624, 160, 16); new game.JumpThru_Platform(1056, 528, 160, 16); new game.JumpThru_Platform(160, 224, 96, 16); new game.JumpThru_Platform(320, 160, 96, 16); new game.JumpThru_Platform(528, 128, 96, 16); new game.JumpThru_Platform(1056, 128, 96, 16); new game.MovingSolid_Platformer_Horizon(450, 800, 128, 32, 730, 2000); new game.MovingSolid_Platformer_Horizon(640, 160, 128, 32, 800, 2000); new game.MovingSolid_Platformer_Vertical(928, 417, 96, 16, 190, 2000); //How To Play new game.Dialogue(42, 790, '-Arrow keys or WASD to move'); new game.Dialogue(42, 824, '-P key to pause the game'); new game.Dialogue(42, 858, '-You can jump up across the brown walls'); //Player this.player = new game.Player(128, 684); //Hide BackScreen this.blackscreen = new game.Graphics(); this.blackscreen.fillColor = '#000000'; this.blackscreen.alpha = 0; this.blackscreen.drawRect(0, 0, game.width, game.height); //Camera Follow Player this.camera = new game.Camera(this.player.sprite); this.camera.position.set(this.player.sprite.position.x,this.player.sprite.position.y); this.camera.limit.x = 0; this.camera.limit.y = 0; this.camera.limit.width = game.width; this.camera.limit.height = game.height; this.camera.acceleration = 20; this.camera.addTo(this.container); this.container.scale.x = 2; this.container.scale.y = 2; }, keydown: function(key) { if (key === 'P' && this.player.sprite.onScreen()) { if (this.paused) { this.resume(); this.blackscreen.remove(); } else { this.pause(); this.blackscreen.addTo(this.stage); this.blackscreen.alpha = 0.5; } } }, update: function() { this.bg.x = this.camera.position.x * 0.4; } }); game.createClass('Player', { classname: 'playerclass', speed: 3, alive: true, wall: false, isOnGround: false, init: function(x, y) { var ths = this; this.sprite = new game.Sprite("player.png"); this.sprite.position.set(x, y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 1, fixedRotation: true, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); this.shape = new p2.Box({ width: this.sprite.width / game.scene.world.ratio, height: this.sprite.height / game.scene.world.ratio }); this.shape.collisionGroup = game.scene.groups.PlayerGroup; this.shape.collisionMask = game.scene.groups.PlayerGroup | game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.PlayerBody; this.body.addTo(game.scene.world); }, checkIfCanJump: function() { for (var i = 0; i < game.scene.world.narrowphase.contactEquations.length; i++) { var c = game.scene.world.narrowphase.contactEquations[i]; if (c.bodyA === this.body || c.bodyB === this.body) { this.isOnGround = true; var d = c.normalA[1]; if (c.bodyB === this.body) d *= -1; if (d > 0.5) { return true; } } } this.isOnGround = false; return false; }, Onslope: function() { var ths = this; for (var i = 0; i < game.scene.world.narrowphase.contactEquations.length; i++) { var c = game.scene.world.narrowphase.contactEquations[i]; if (game.scene.player.body.velocity[1] < 0 && ((c.bodyA === this.body && c.bodyB.collisionGroup === game.Body.SlopePlatformBody) || (c.bodyB === this.body && c.bodyA.collisionGroup === game.Body.SlopePlatformBody))) { this.body.mass = 0; this.body.velocity[1] = 0; var d = c.normalA[1]; if (c.bodyB === this.body) d *= -1; if (d > 0.5) { return true; } } } this.body.mass = 1; return false; }, OnWall: function() { var ths = this; if(this.wall){ game.Timer.add(150, function() { ths.wall= false; }); if (this.sprite.scale.x == -1) { //this.body.velocity[0] = 16; this.body.position[0] = this.body.position[0] + 0.06; }else{ //this.body.velocity[0] = -16; this.body.position[0] = this.body.position[0] - 0.06; } this.body.velocity[1] = -6; } for (var i = 0; i < game.scene.world.narrowphase.contactEquations.length; i++) { var c = game.scene.world.narrowphase.contactEquations[i]; if ((c.bodyA === this.body && c.bodyB.collisionGroup === game.Body.WallBody) || (c.bodyB === this.body && c.bodyA.collisionGroup === game.Body.WallBody)) { if(!this.isOnGround){ if (game.scene.player.body.velocity[1] > 2 && game.keyboard.down('W')) { this.wall = true; return true; } } } } return false; }, play: function(anim) { if (this.sprite.currentAnim === this.sprite.anims[anim]) return; this.sprite.play(anim); }, destroy: function() { game.scene.blackscreen.addTo(game.scene.stage); this.sprite.remove(); this.body.remove(); game.scene.removeObject(this) var tween1 = new game.Tween(game.scene.blackscreen); tween1.to({ alpha: 1 }, 1000); tween1.easing('Quadratic.InOut'); tween1.start(); tween1.onComplete(function() { game.system.loadScene('Main'); }); }, update: function() { var ths = this; console.log(this.wall); if (!this.sprite.onScreen()) { this.destroy(); } if (this.checkIfCanJump() || game.scene.player.body.velocity[1] > 2) { if (game.keyboard.down('S')) { ths.shape.collisionGroup = game.scene.groups.PlayerGroupFilter; } else { ths.shape.collisionGroup = game.scene.groups.PlayerGroup; } } else if (game.scene.player.body.velocity[1] < 2) { ths.shape.collisionGroup = game.scene.groups.PlayerGroupFilter; } this.OnWall(); 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; this.Onslope(); if(!this.wall){ if (game.keyboard.down('A')) { this.body.velocity[0] = -this.speed; this.sprite.scale.x = -1; } else if (game.keyboard.down('D')) { this.body.velocity[0] = this.speed; this.sprite.scale.x = 1; } else { this.body.velocity[0] = 0; } } //Jump if (this.checkIfCanJump()) { if (game.keyboard.down('W')) { this.isonSlope = false; this.body.velocity[1] = -6; } } }, }); game.createClass('Wall_Platform', { init: function(x, y, width, height) { this.sprite = new game.Graphics(); this.sprite.fillColor = '#895103'; this.sprite.drawRect(0, 0, width, height); this.sprite.position.set(this.sprite.width / 2 + x, this.sprite.height / 2 + y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 0, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var ratio = game.scene.world.ratio; this.shape = new p2.Box({ width: this.sprite.width / ratio, height: this.sprite.height / ratio }); this.shape.collisionGroup = game.scene.groups.GROUND; this.shape.collisionMask = game.scene.groups.PlayerGroup | game.scene.groups.PlayerGroupFilter | game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.WallBody; this.body.addTo(game.scene.world); }, 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; } }); game.createClass('Solid_Platform', { init: function(x, y, width, height) { this.sprite = new game.Graphics(); this.sprite.fillColor = '#2a2a2a'; this.sprite.drawRect(0, 0, width, height); this.sprite.position.set(this.sprite.width / 2 + x, this.sprite.height / 2 + y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 0, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var ratio = game.scene.world.ratio; this.shape = new p2.Box({ width: this.sprite.width / ratio, height: this.sprite.height / ratio }); this.shape.collisionGroup = game.scene.groups.GROUND; this.shape.collisionMask = game.scene.groups.PlayerGroup | game.scene.groups.PlayerGroupFilter | game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.PlatformBody; this.body.addTo(game.scene.world); }, 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; } }); game.createClass('JumpThru_Platform', { init: function(x, y, width, height) { this.sprite = new game.Graphics(); this.sprite.fillColor = 'blue'; this.sprite.drawRect(0, 0, width, height); this.sprite.position.set(this.sprite.width / 2 + x, this.sprite.height / 2 + y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 0, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var ratio = game.scene.world.ratio; this.shape = new p2.Box({ width: this.sprite.width / ratio, height: this.sprite.height / ratio }); this.shape.collisionGroup = game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.PlatformBody; this.body.addTo(game.scene.world); }, 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; } }); game.createClass('Slope_Solid_Platform', { init: function(x, y, width, height, angle) { this.sprite = new game.Graphics(); this.sprite.fillColor = '#860000'; this.sprite.drawRect(0, 0, width, height); this.sprite.position.set(this.sprite.width / 2 + x, this.sprite.height / 2 + y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 0, angle: angle, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var ratio = game.scene.world.ratio; this.shape = new p2.Box({ width: this.sprite.width / ratio, height: this.sprite.height / ratio }); this.shape.collisionGroup = game.scene.groups.GROUND; this.shape.collisionMask = game.scene.groups.PlayerGroup | game.scene.groups.PlayerGroupFilter | game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.SlopePlatformBody; this.body.addTo(game.scene.world); }, 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; } }); game.createClass('MovingSolid_Platformer_Horizon', { init: function(x, y, width, height, hx, speed) { this.speed = speed; this.sprite = new game.Graphics(); this.sprite.fillColor = '#2a2a2a'; this.sprite.drawRect(0, 0, width, height); this.sprite.position.set(this.sprite.width / 2 + x, this.sprite.height / 2 + y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 0, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var ratio = game.scene.world.ratio; this.shape = new p2.Box({ width: this.sprite.width / ratio, height: this.sprite.height / ratio }); this.shape.collisionGroup = game.scene.groups.GROUND; this.shape.collisionMask = game.scene.groups.PlayerGroup | game.scene.groups.PlayerGroupFilter | game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.Float_PLATFORM_HORIZON; this.body.collideAgainst = [game.Body.PLAYER]; this.body.addTo(game.scene.world); game.Tween.add(this.sprite.position, { x: hx }, speed, { repeat: Infinity, yoyo: true }).start(); }, collidePlayer: function() { for (var i = 0; i < game.scene.world.narrowphase.contactEquations.length; i++) { var c = game.scene.world.narrowphase.contactEquations[i]; if ((c.bodyA === this.body && c.bodyB.collisionGroup === game.Body.PlayerBody) || (c.bodyB === this.body && c.bodyA.collisionGroup === game.Body.PlayerBody)) { return true; } } return false; }, update: function() { if (this.collidePlayer()) { game.scene.player.body.position[0] -= (this.body.position[0] - (this.sprite.position.x / game.scene.world.ratio)); } this.body.position[0] = this.sprite.position.x / game.scene.world.ratio; this.body.position[1] = this.sprite.position.y / game.scene.world.ratio; this.sprite.rotation = this.body.angle; } }); game.createClass('MovingSolid_Platformer_Vertical', { init: function(x, y, width, height, vy, speed) { this.speed = speed; this.sprite = new game.Graphics(); this.sprite.fillColor = '#2a2a2a'; this.sprite.drawRect(0, 0, width, height); this.sprite.position.set(this.sprite.width / 2 + x, this.sprite.height / 2 + y); this.sprite.anchorCenter(); this.sprite.addTo(game.scene.container); this.body = new game.Body({ mass: 0, fixedRotation: false, position: [ this.sprite.position.x / game.scene.world.ratio, this.sprite.position.y / game.scene.world.ratio ], }); var ratio = game.scene.world.ratio; this.shape = new p2.Box({ width: this.sprite.width / ratio, height: this.sprite.height / ratio }); this.shape.collisionGroup = game.scene.groups.GROUND; this.shape.collisionMask = game.scene.groups.PlayerGroup | game.scene.groups.PlayerGroupFilter | game.scene.groups.GROUND; this.body.addShape(this.shape); this.body.collisionGroup = game.Body.Float_PLATFORM_VERTICAL; this.body.collideAgainst = [game.Body.PLAYER]; this.body.addTo(game.scene.world); game.Tween.add(this.sprite.position, { y: vy }, speed, { repeat: Infinity, yoyo: true }).start(); }, collidePlayer: function() { for (var i = 0; i < game.scene.world.narrowphase.contactEquations.length; i++) { var c = game.scene.world.narrowphase.contactEquations[i]; if ((c.bodyA === this.body && c.bodyB.collisionGroup === game.Body.PlayerBody) || (c.bodyB === this.body && c.bodyA.collisionGroup === game.Body.PlayerBody)) { return true; } } return false; }, update: function() { if (this.collidePlayer()) { game.scene.player.body.position[1] -= (this.body.position[1] - (this.sprite.position.y / game.scene.world.ratio)); } this.body.position[0] = this.sprite.position.x / game.scene.world.ratio; this.body.position[1] = this.sprite.position.y / game.scene.world.ratio; this.sprite.rotation = this.body.angle; } }); game.createClass('Dialogue', { init: function(x, y, txt) { this.text = new game.SystemText(txt); this.text.size = 18; this.text.color = '#fdfdfd'; this.text.position.set(x, y); this.text.addTo(game.scene.container); } }); // Attributes for different body types game.addAttributes('Body', { PlayerBody: 0, PlayerAttackBody: 1, PlatformBody: 2, SlopePlatformBody: 3, WallBody: 4 }); });  
  10. Like
    khleug35 reacted to Stephan in Top Down Shooter Template   
    Great work! 😃
  11. Thanks
    khleug35 got a reaction from Wolfsbane in [Solved]How to get the TextureFrame number of a playing animation   
    @Wolfsbane
    sorry for reply lately,
    Thank you for your answer and advice, really thanks.
  12. Like
    khleug35 reacted to Wolfsbane in Is Panda.JS dead   
    No.
    Maybe a quiet community, though.
  13. Like
    khleug35 reacted to Wolfsbane in [Solved]How to get the TextureFrame number of a playing animation   
    No need to do this at least: anim has an attribute currentFrame. So you can simply do:
    if (this.anim.currentFrame === 4){ //currentFrame will start from 0-size of animation. // dosomething }  
    I took a look, and we really don't seem to have the textureFrame==46 style..  It's convenient, but if you're going to hard-code a number in there, I much prefer just hard coding to the 0,1,2,3 convention. 
    Think of this: You know you're animation framing is going to be 0=first frame, 1=second frame. Now: If you update your spritesheet.png, and suddenly
    If you hard-code in =46, and then the image changes, then both the image, and your code has to change.
    Does that make sense? 
     
     
  14. Like
    khleug35 got a reaction from Wolfsbane in [Solved]Collision detection problem for P2 plugin   
    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; } } });  
  15. Like
    khleug35 reacted to Stephan in [Solved]Collision detection problem for P2 plugin   
    Great! Glad I could help you. 😊
  16. Like
    khleug35 reacted to enpu in p2.js plugin   
    Enable advanced physics with p2.js including collision detection, contacts, friction, restitution, motors, springs, advanced constraints and various shape types.
    Preview: https://www.panda2.io/plugins/p2
    Download: https://www.panda2.io/plugins
  17. Like
    khleug35 reacted to Stephan in [Solved]Collision detection problem for P2 plugin   
    hi,
     
    Have you set up the code in Mainscene correctly? It should look something like this:
     
    add world this.world = new game.Physics({ gravity: [0, 1], }); //add eventhandler collision this.world.on("beginContact",function(event){ if(typeof event.bodyA.collide !== 'undefined'){ event.bodyA.collide(event.bodyB); } if(typeof event.bodyB.collide !== 'undefined'){ event.bodyB.collide(event.bodyA); } });  
  18. Like
    khleug35 reacted to enpu in bugfix for Panda2 p2 plugin   
    Yeah i'm still here!  Just been a bit busy lately, but i am working on Panda 2!
  19. Like
    khleug35 reacted to Wolfsbane in bugfix for Panda2 p2 plugin   
    Haha. 😂
    Enpu's still around, and fixes things when problems are found, or add's new stuff.
    I think the communities just been a bit quiet. I've been pretty swamped to work work on any of my own stuff.
  20. Like
    khleug35 reacted to mazoku in Blocks Puzzle   
    Simple classic Blocks Puzzle game where you make rows and columns of blocks. 
    Play Blocks Puzzle
    Get Blocks Puzzle for Android

     
     
     
  21. Like
    khleug35 reacted to Wolfsbane in Space Shooter J Hit   
    Hey, congrats on finishing another game. I've given it a go on PC for the moment, and got so far as stage 6. It plays really well! And looks pretty good. But no sound?
    Will play on the Android version a bit later, and let you know how that plays.  👍
     
     
  22. Like
    khleug35 got a reaction from b10b in Space Shooter J Hit   
    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/
  23. Thanks
    khleug35 got a reaction from Wolfsbane in Space Shooter J Hit   
    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/
  24. Like
    khleug35 got a reaction from Wolfsbane in (Solved)How to check if the timer is paused??   
    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. 
     
     
  25. Like
    khleug35 reacted to Stephan in (Solved)How to check if the timer is paused??   
    there is no public property available but you could use the following private property 
    timer._pause  
    working example:
    var timer = game.Timer.add(1000, function() { sprite.remove(); }); if(timer._pause){ console.log("paused") } else{ console.log("Not paused") }