Wolfsbane

Members
  • Content Count

    197
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. Like
    Wolfsbane reacted to greencoder in Playfab Plugin?   
    An update about this thread, to sum it up, thanks @enpu, it works. For some reason, my PC's Panda IDE was an old version and it might have caused the issue. So here are the steps : 
    Download latest panda IDE Update the engine to the latest in your project Download PlayFabClientApi.js from https://download.playfab.com/PlayFabClientApi.js into the media folder  Add game.addAsset('PlayFabClientApi.js') to your game.main Add the following snippet to test whether it works (I used it in init of game.main), ideally when you run this in the IDE or the browser, a player will be created on PlayFab : 
      var loginRequest = { TitleId: '<your game ID>', CustomId: <custom ID>, CreateAccount: true }; PlayFabClientSDK.LoginWithCustomID(loginRequest, function(result, error) { if (!error) { console.log('PF ID: ' + result.data.PlayFabId); } else { console.log(error);} });  
    As a next step, I prefer to make PlayFabClientApi.js into a plugin, like the instantgames plugin and load the script dynamically and not bundle it with the package. I shall keep this thread updated if the plugin is a success, or maybe drop if off in the plugins sub forum. 
    Once again, thanks @enpu!
    @Stephan, there you go, done! Time to start with the game, yay! 
  2. Like
    Wolfsbane reacted to greencoder in [Solved] Exporting Instant Games Do Not Work   
    @Stephan hehe! 
    @Wolfsbane,  ... 
    UPDATE : Preloader is working as intended, no issues as I thought. 
  3. Like
    Wolfsbane reacted to greencoder in [Solved] Exporting Instant Games Do Not Work   
    So, answering your question :  upload the old (working) game again and see if it succeeds or fails - it fails. I had to modify fbapp-config.json to this and the old prototype works : 
    {"instant_games": { "custom_update_templates": { "play_turn": { "example":"Edgar played their move" } }, "platform_version":"RICH_GAMEPLAY", "orientation": "PORTRAIT", "override_web_orientation": "LANDSCAPE", "navigation_menu_version": "NAV_FLOATING" } } Now the only way to create a new instant game project with Panda2 is :
    Create your new project in Panda2 Add the instantgames plugin Add plugin to game.main .require  add the following to game.config  instantGames: { system: { resize: true } } Create a bundle folder with app display name (like on facebook without spaces) Add the above mentioned fbapp-config.json Copy the media folder of your project to this folder Add an index.html with <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Panda Game</title> <script type="text/javascript" src="game.min.js"></script> </head> <body> </body> </html>  
    Export the project as "Minify" into the bundle folder, this should export the game.min.js Zip the bundle with same name as the facebook app display name without spaces and upload it The build should run, ideally. Gonna try out this a couple of times with different prototypes of mine now and will post back if it doesn't work. 
  4. Thanks
    Wolfsbane reacted to Stephan in System Text line break and typewriter-effect update   
    Here it is, a small System Text plugin with 3 features:
     
    1) typewriter effect
    2) strokeColor (border)
    3) example how to use gradient colors with systemText in Panda.
     
    Please note that I included a custom font in the project to achieve the second and third example. See the demo project for files ans details at: 
    https://github.com/stephanvermeire/systemtextplugin
     
    Quick example (typewrite effect not working here because it is a static image):

     
    systemtextplugin.js
    game.module( 'plugin.systemtextplugin' ) .require( 'engine.renderer.text' ) .body(function() { game.SystemText.inject({ /** Enable typewriter-effect @default false **/ typing_effect: false, i: 1, /** StrokeColor of the text. @property {String} color @default #000 **/ strokeColor: '#000', /** Width of the text stroke. @property {Number} color @default 0 **/ lineWidth: 0, _renderCanvas: function(context) { var wt = this._worldTransform; context.globalAlpha = this._worldAlpha; context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * game.scale, (wt.ty + this.size) * game.scale); context.fillStyle = this.color; context.font = this.size * game.scale + 'px ' + this.font; context.textAlign = this.align; context.strokeStyle = this.strokeColor; context.lineWidth = this.lineWidth; if(this.text === undefined) return; var lines; if(this.typing_effect){ lines = String(this.text.substr(0, this.i)).split('\n'); if(this.i <= this.text.length){ this.i++; } }else{ lines = this.text.split('\n'); } for (var i = 0; i<lines.length; i++){ context.fillText(lines[i], 0, (i*this.size) ); if(this.lineWidth){ context.strokeText(lines[i], 0, (i*this.size)); } } } }); });  
    main.js
    game.module( 'game.main' ) .require( 'plugin.systemtextplugin' ) .body(function () { game.createScene('Main', { init: function () { //typewriter demo new game.SystemText('Lorem ipsum dolor sit amet,\nconsectetuer adipiscing elit.\nSed posuere interdum sem.', { size: 50, x: 0, y: 0, typing_effect: true, }).addTo(this.stage); //custom font with strokeColor new game.SystemText('Lorem ipsum dolor sit amet,', { font: 'SoSweetHoney', // align: 'left', color: '#2d963b', strokeColor: '#a2e65e', lineWidth: 2, size: 50, x: 0, y: 300, }).addTo(this.stage); //gradient font color const color = game.renderer.context.createLinearGradient(0, 0, game.width, 0); color.addColorStop(0, "#f47c35"); color.addColorStop(1, "#e6e650"); const strokeColor = game.renderer.context.createLinearGradient(0, 0, game.width, 0); strokeColor.addColorStop(0, "#a2e65e"); strokeColor.addColorStop(1, "#3577ca"); let test = new game.SystemText('Lorem ipsum dolor sit amet!', { font: 'SoSweetHoney', lineWidth: 2, size: 50, x: 0, y: 500, }).addTo(this.stage); test.color = color; test.strokeColor = strokeColor; } }); });  
     
    index.html
    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Panda 2 - SystemText</title> <link rel="stylesheet" href="style.css" media="all" /> <script type="text/javascript" src="src/engine/core.js"></script> <script type="text/javascript" src="src/game/config.js"></script> <script type="text/javascript" src="src/game/main.js"></script> </head> <body> </body> </html> Note that you have to include the fonts directory as well as the style.css file in your project to make the custom font work!
  5. Like
    Wolfsbane reacted to khleug35 in System Text line break and typewriter-effect update   
    @Stephan   @Wolfsbane
    Thank for comment😀😀😀
    About is it better as a module?.......
    ask him is better 😀 @enpu
  6. Like
    Wolfsbane got a reaction from khleug35 in System Text line break and typewriter-effect update   
    That's very cool! 👍👍
    Also, code looks good to me.
    Wondering if it should be added into the engine itself, or maybe better as a module?
  7. Like
    Wolfsbane reacted to khleug35 in System Text line break and typewriter-effect update   
    Hello, I would like to add small update to the System Text in text.js in order to make it have New Lines like <br> and typewriter-effect like RPG dialogue.
    Demo.
    new game.SystemText('Lorem ipsum dolor sit amet,\nconsectetuer adipiscing elit. Sed posuere interdum sem.\nQuisque ligula eros ullamcorper quis,\nlacinia quis facilisis sed sapien.\nMauris varius diam vitae arcu.\nSed arcu lectus auctor vitae,\nconsectetuer et venenatis eget velit.'); if the text includes "\n", it become line breaks like <br>
    and user enable typing_effect = true;
    the text have  typewriter-effect like RPG dialogue.

     
    First, 
    render\text.js
    Add typing_effect varable.
    game.createClass('SystemText', 'Container', { ... /** Enable typewriter-effect @default false **/ typing_effect: false, i: 1, ...  
    Add the following code, when user type "\n", it can do line break effect
    var lines = this.text.split('\n');  //Check New Lines
    for (var i = 0; i<lines.length; i++){
    context.fillText(lines, 0,  (i*this.size) );
     
    _renderCanvas: function(context) { var wt = this._worldTransform; var ths = this; context.globalAlpha = this._worldAlpha; context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * game.scale, (wt.ty + this.size) * game.scale); context.fillStyle = this.color; context.font = this.size * game.scale + 'px ' + this.font; context.textAlign = this.align; if(this.text == undefined){ context.fillText(this.text, 0, 0); }else{ if(this.typing_effect){ //Enable Typewriter-effect var lines = String(this.text.substr(0, this.i)).split('\n'); if(this.i <= this.text.length){ this.i++; } }else{ var lines = this.text.split('\n'); //Check the text include '/n' } for (var i = 0; i<lines.length; i++){ context.fillText(lines[i], 0, (i*this.size) ); } } }  
    Main.js
    Enable typing_effect
    this.text.typing_effect = true;
    game.module( 'game.main' ) .body(function() { game.createScene('Main', { init: function() { var ths = this; this.text = new game.SystemText('Lorem ipsum dolor sit amet,\nconsectetuer adipiscing elit. Sed posuere interdum sem.\nQuisque ligula eros ullamcorper quis,\nlacinia quis facilisis sed sapien.\nMauris varius diam vitae arcu.\nSed arcu lectus auctor vitae,\nconsectetuer et venenatis eget velit.'); this.text.size = 50; this.text.font = 'serif'; this.text.color = '#ffffff'; this.text.typing_effect = true; //Enable typewriter-effect this.text.x = 10; this.text.addTo(this.stage); // this.text.text = 'Hello\nPanda'; }, update:function(){ } }); });  
    Could you update this  @enpu?
    my code may be not good or more hardcode or not the best solution to achieve , Welcome to give me a feedback to improve my coding skill,
    Thanks
     
    text.js
  8. Like
    Wolfsbane 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
     
  9. Like
    Wolfsbane reacted to BillyKane in Is Panda 2 Dead?   
    At least, 
    Notify in official website 'News' and 'BUY NOW' page that the editor is closed off and stop support as a temporary.
    @enpu is a versatile.he can act, sing, coding, music making, video director and video editing.....
    I guess his life is colorful and busy. 
    Hope @enpu still working on Panda 2.
  10. Like
    Wolfsbane reacted to greencoder in [Solved] Exporting Instant Games Do Not Work   
    Found the issue, it was the game name in the config file. It should be exactly the same as facebook app name, else facebook will block in uploading the build.
  11. Like
    Wolfsbane reacted to Stephan in bugfix for joystick plugin   
    Hi,
     
    I would like to add to propose the following small update to the joystick plugin in order to make it compatible with hires scaling:
     
    var radius = this.bg.shapes[0].shape.radius / 2; must become:
    var radius = this.bg.shapes[0].shape.radius / 2 / game.scale; could you update this  @enpu?
     
    Thanks!
  12. Like
    Wolfsbane got a reaction from khleug35 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 
     
  13. Like
    Wolfsbane reacted to khleug35 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
  14. Like
    Wolfsbane reacted to khleug35 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 }); });  
  15. Like
    Wolfsbane reacted to John swana in 'watchmyback' my final idea of a game less than 13kb   
    How is the game , almost done. 
     
    https://swashvirus.github.io/watchmyback/
  16. Like
    Wolfsbane reacted to Stephan in Error with Spine version 3.8.60   
    quick fix for the time being: you can change the spine version in spine settings => Version =>to 3.7.x (dropdown) and it should work again.
     
  17. Thanks
    Wolfsbane reacted to khleug35 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.
  18. Like
    Wolfsbane got a reaction from khleug35 in Is Panda.JS dead   
    No.
    Maybe a quiet community, though.
  19. Like
    Wolfsbane reacted to odiusfly in GameDistribution - Again and Again - Serious?   
    Hello guys and basically this topic is for you guys/developers that upload games on gamedistribution so,
    I read too many topics with gamedistribution and all you guys/developers that you read all bad comments, "gamedistribution not pay me yet", "gamedistribution this, that" but you still continue upload to this website and support it? Serious? And the funny is, upload too many games to get in 1-3 or more months ........  What/How earning? 50euros? Or less?
    They own complete chain in advertising. So officially you get 1/3 of the income of a game. But they get often 2/3 because 1/3 for gamedistribution but also 1/3 since they own big game portals like Kizi.
    But also: You get 1/3 of the net income. But the ads are sold by their own advertising company so they can control different between Gross and Net.
    So they get up to 70% and you get 15% ............ if you are lucky!
     
    My experience to them? -> Of course. I get ~100euros in 6months from 10+ games... And when i remove all and i upload to other portal, i get ~200euros in 1 month from 2 games only. Imagine how % you get from your games. Even your game is addictive, even is top of the top....... You still lose a lot money.
     
    So you can continue upload your games, no problem. And open topics again or post to ask for help. Send them unlimited emails, will answer when they want.
    Cheers.
     
    By the way,
    @GameDistribution Support
    I'm still waiting "success stories" ? Can you share some original-success stories? Remember? I post under your post in this topic (June 18):
     
     
    P.S 1: Why open this topic ? -> One (1) only answer : To help new developers and their games. I learn from my mistakes. Bad experience with this company and similar. So i share true stories, that's all.
    P.S 2: How know and share all this ? -> This is personal sorry but thanks to a friend, he knows.
    P.S 3: Am i wrong? -> As i said, no problem, you can still continue upload your games. Your results from your earnings is the only truth.
  20. Like
    Wolfsbane got a reaction from GameQuack.com in Top-down racing game - PoC   
    I like it! But after 20 levels or so, I start to lose a purpose? Procedurally generated levels are cool, but if everything else stays the same (AI competition, my driving ability, the challenge/risk) then the levels still end up feeling the 'same'.
    Definitely work on it more. But the next step is to add increasing difficulty/challenge, and maybe some kind of end-game mechanism. Lives/losing system is standard, and would work ok. 3 lives, you get further and further, each time you slip up, you lose a chance.
    For increased difficulty, either road obstacles start appearing (bombs in the road? Cow crossing the street? tornado blowing around the map ala Super Speed?), the AI starts getting a bit faster (or more aggressive! Maybe they get spikes on their wheels after level 10.... or one of them gets their hands on a shotgun. ) 
    Also add scoring. Keep track of how many levels get beaten, and then save them in an online highscore. I just beat 20 levels, and I don't feel like doing it again. I 'might' do it again, if some guy beat 30 levels, and I know for sure I can beat that.  
    Also: Took me at least 10 levels before I realized the levels were procedural. 😛 
    Good luck!
  21. Like
    Wolfsbane got a reaction from khleug35 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? 
     
     
  22. Like
    Wolfsbane reacted to b10b in Everything to create fb instant game   
    I'll have a stab at these as I like to snapshot my view on things periodically ...
    Yes and yes.  Pixi has a very decent power to size ratio and solid compatibility (v4.8 may be wisest in 2019?).  For a competent developer capable of spinning their own game structure Pixi is ideal for a lightweight browser game.  Coming in at less than 5MB total for your IG is wisest.
    Red tape aside, it's possible but improbable to make money releasing a single game.  Primary monetisation choice with FB IG is in-game ads (which are a low value transaction for a developer and an intrusion to the player).  In-game purchases have more value but will require significant retention first.  Or consider indirect value generation such as consultancy services, brand building, learning for the next game?
    FB IG is inherently multiplayer (async).  Within the SDK are context (group) leaderboards, notifications, packet sharing (challenges).  That being said the vast majority of initial plays will be in solo mode, so a compelling single player experience is necessary for retention.  Get creative for the crossover!  For more advanced multiplayer use a custom backend.  Having some separation / abstraction from the Facebook SDK might be wise in case other markets are a better fit for your game?
    For Multiplayer specifically?  Yes there's a TicTacToe example that covers the basics of a client-server model.
    My advice is play some of the popular titles, understand what the FB IG audience seem to be attracted to and how other developers are leveraging the SDK to create retention and monetisation - warning, some of it can be ugly.  Iterative development is going to be crucial, however you'll likely only be promoted once - so use it wisely, and use each territory to run a split test.  Or build several games and apply the learning from one to the next etc.
    If you haven't built dozens of games already, FB IG probably isn't for you yet?  Imo there are better platforms that can help evolve game development skills and player retention mechanics.  Instead see FB IG as a specific audience with a specific style of game - developing a game precisely for that might work out very well (FB has a HUGE potential audience after all).
    Imo Messenger games should be about decorating a conversation, in the same way filters decorate a photo.  So quick, contextual, personalised, fun, indisposable.  That's not necessarily a standard casual game, so changing some assumptions and expectations may be wise.  Just my advice, your mileage might vary!
  23. Like
    Wolfsbane reacted to RottingPixels in CHECK OUT OUR FREE GAME ASSETS PACKS! ROTTINGPIXELS.ITCH.IO   
    Our Four Seasons Platformer Tileset has just been released! 100% FREE! Get your hands on it
    @https://rottingpixels.itch.io/four-seasons-platformer-tileset-16x16free
  24. Like
    Wolfsbane reacted to Stephan in Spine plugin enhancement   
    Hi @enpu
    I have a small request for the Spine plugin. In the previous version of Panda there used to be a property animationSpeed that could be used to alter the speed of the spine animation. I noticed that this prop is lacking in the current version of tne plugin. It was easy enough to add myself but since the plugin is not open source, I cannot create a pull request for you. Could you add the following code to the plugin?
     
    spine.js
    game.createClass('Spine', 'Container', { ... animationSpeed: 1, ... updateTransform: function() { this.state.update(game.delta * this.animationSpeed); ... } }) Thanx, Stephan
  25. Like
    Wolfsbane reacted to Nagval333 in Some guy stole my game :)   
    Ok, It's was fast. The app support wrote to that "guy" about my complaint and give him possibility to confirm his rights for an app or remove it (at the same time they encourage the both parties dispute directly with one another to resolve the claim). Anyway, the "guy" wrote me that "he's sorry" and removed the app 😎
    P.S  In the end I decided to complaint to Chrome Web Store too, and 10 days after they replied me that a game will be removed.