khleug35

Members
  • Content Count

    118
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by khleug35

  1. 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
  2. khleug35

    p2.js plugin

    P2.js very very very powerful Physics Engines!!!!!!!!!
  3. @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
  4. 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
  5. 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; } } });
  6. Your game assets also can access for everyone
  7. Nice Game good work!!!!!!!
  8. @Wolfsbane Thank you for your playing Yes, This game no sound at present, I will add sound soon hope you enjoy it
  9. 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/
  10. @Stephan Awesome !!! it work!!!!! Thank you very much for the awesome code and teaching me!!!  Have a nice day!!! Thanks again!!!
  11. @taoprox Thank you for a reply and remind, my apologies for misspelling but I using 'paused' now and not work : (
  12. 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.
  13. Thanks for this!!!!!!!! you are an absolute legend! I love this. I will build 3D game for my third panda2 game
  14. Oh dxmn !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I missed Storage Example from https://www.panda2.io/examples#storage-get In Panda2, in order to make save, I don't need to use localStorage it just use game.storage , my problem can solved. here is some example for saving game data game.config = { storage: { id: 'myGame' } }; game.module( 'game.main' ) .body(function() { game.createScene('Main', { init: function() { if(game.storage.get('score') === undefined || game.storage.get('score') === null ){ this.number = 1; game.storage.set('score', this.number); }else{ this.number = game.storage.get('score'); } this.shownumber = new game.SystemText(this.number); this.shownumber.size = 36; this.shownumber.font = 'serif'; this.shownumber.color = '#ff0000'; this.shownumber.align = 'center'; this.shownumber.x = game.width / 2; this.shownumber.addTo(this.stage); } , mousedown: function() { this.number++; game.storage.set('score', this.number); }, update: function() { this.shownumber.text = this.number; }, }); }); @enpu Thanks
  15. @enpu Thanks The following is my Panda 2 log files error code [2019-02-16 17:59:23.389] [error] panda-toolkit error: /Users/admin/Desktop/Game/Burning/src/game/main.js:2 if(localStorage.getItem("Upgrade") === undefined || localStorage.getItem("Upgrade") === null){ ^ ReferenceError: localStorage is not defined at Object.<anonymous> (/Users/admin/Desktop/Game/Burning/src/game/main.js:2:4) at Object.<anonymous> (/Users/admin/Desktop/Game/Burning/src/game/main.js:2757:3) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at requireScriptTags (/Applications/Panda 2.app/Contents/Resources/app.asar/node_modules/panda-toolkit/build.js:82:13) [2019-02-16 17:59:23.404] [error] panda-toolkit exit: 1 the log display that localStorage is not defined. I think that the localStorage can't put out of game .modules tab. but the game can play on the web, only not work in mobile Any good idea to create the save game function in the game and work on mobile?? Thank you very much
  16. Hello everyone , I would like to create save game function for my new game. so I using localStorage method, the following is my code, I write the script out of game.modules tab. if(localStorage.getItem("SAVEGAME") === undefined || localStorage.getItem("SAVEGAME") === null){ var savedata =0; localStorage.setItem("SAVEGAME", savedata); }else{ localStorage.getItem("SAVEGAME") } game.module( 'game.main' ) .require( 'game.player' ) .body(function() { game.createScene('Main', { init: function() { var text = new game.SystemText('Hello Panda'); text.size = 36; text.addTo(this.stage); } }); }); The game is not an error. but I Export project to build apk. the editor display this message. how to solve this problem? thank you very much. thx
  17. @enpu OH, Thank you very much for this solution, !! I downloaded the example It is more helpful and work for me !!!! thanks again
  18. About the joystick plugin problem. Is it possible to make the sprite rotation angle follow by joystick pad position?? if the joystick pad move to right-left, the sprite angle is right-left like the following images The following is my solution, but I think it is not the best way. I create the hidden object and the joystick can control the hide sprite movement. this.gun.rotation= this.gun.position.angle(game.scene.HiddenObject.point.position); like the following image Hidden object class game.createClass('HiddenObject', { init: function() { this.point = new game.Sprite('circle2.png') this.point.anchorCenter(); this.point.alpha =0 this.body = new game.Body(); this.body.collisionGroup = game.Body.POINTER; this.body.collideAgainst= [game.Body.WALL]; this.body.position.x = 500; this.body.position.y = 600; var shape = new game.Rectangle(this.point.width, this.point.height); this.body.addShape(shape); this.body.addTo(game.scene.world); this.body.collide = this.collide.bind(this); var ths = this; }, collide: function(body) { if (body.collisionGroup === game.Body.WALL) { return true; } return true; }, update: function() { if(game.scene.joystick2.axis.x ==0 && game.scene.joystick2.axis.y ==0){ this.body.velocity.x = 0; this.body.velocity.y = 0; } this.point.position.x = this.body.position.x; this.point.position.y = this.body.position.y; this.body.velocity.x += game.scene.joystick2.axis.x * 4800; this.body.velocity.y += game.scene.joystick2.axis.y * 4800; } Rotation Sprite class game.createClass('rotationsprite', { init: function() { this.gun = new game.Sprite('gun.png'); this.gun.anchorCenter(); this.gun.position.set(450, 550); this.gun.addTo(game.scene.container); }, update: function(){ this.gun.rotation= this.gun.position.angle(game.scene.HiddenObject.point.position); } } }); Any idea,? thank, I am sorry about my poor English.
  19. @ShrewdPixel Thank you for your suggestion and thank you for playing Your comment is very helpful to make improve my game quality to my next game. Thank you for play all game to Game Showcase Pages and leave a more useful comment to each developer, thanks , have a nice day!
  20. Very awnsome game!!!! Good Job, Great work!!! I Can't Stop Playing It,
  21. Great Jobs, Thank for the update
  22. @enpu Thank you for reply and suggestion. TinyPNG and TexturePacker is a nice, simple to compress images online, thx
  23. @Wolfsbane Thx for reply The reason for I doing each scene load. I hope I don't want to load all asset in the main scene(it will case initial load time quite slow) so I doing each scene load. I tested it, when the game load the assets for each one time. the second time very too fast, so I think when the system load the assets one time, It will not load the asset again every time.
  24. Hello, @enpu I have received feedback, my new game in android app's load time slow and it can be improved. I take a video for reference. https://www.youtube.com/watch?v=WWN6Zc5ceug for my phone 0:00 - 0:02 The initial load time is taken 2sec. 0:04 - 0:09 Stage Select load time is taken 5sec. 0:10 - 0:12 Stage 1 load time is taken 2sec. 2:56 - 2:58 Stage 2 load time is taken 2sec. 5:12 - 5:14 Stage 3 load time is taken 2sec. 8:20 - 8:23 Stage 4 load time is taken 3sec. 12:27 - 12:29 Final Stage load time is taken 2sec. 15:41 - 15:46 Final Stage 2 load time is taken 5sec. For me, I think that the load time is not very very slow, but is it possible to improve??? thank you very much