Jump to content

Search the Community

Showing results for tags 'lewster32'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. I'm trying to create simple isometric game using @lewster32's iso plugin, where player needs to transport his/her hero from point A to point B in simple city. Nothing special there. However, some buildings start flickering and I can't figure how to stop it. Only solution I came up with, is that I place them in air but that's not very good because small character can go below them. It seem that the issue is with body.immovable = true and body.moves = false commands. If I give those for the field itself, flickering starts. My code: var kentta; var house; var cube; var game = new Phaser.Game(1280, 800, Phaser.AUTO, 'test', null, true, false); var BasicGame = function (game) { }; BasicGame.Boot = function (game) { }; var isoGroup, player; BasicGame.Boot.prototype = { preload: function () { game.load.image('cube', 'police_dep.png'); game.load.image('kentta', 'kentta1.png'); game.load.image('house1', 'house1.png'); game.load.image('house2', 'house2.png'); game.load.image('house3', 'house3.png'); game.load.image('house5', 'house5.png'); game.load.image('house6', 'house6.png'); game.load.image('park', 'park.png'); game.load.image('factory', 'factory.png'); game.time.advancedTiming = true; // Add and enable the plug-in. game.plugins.add(new Phaser.Plugin.Isometric(game)); // Start the IsoArcade physics system. game.physics.startSystem(Phaser.Plugin.Isometric.ISOARCADE); // This is used to set a game canvas-based offset for the 0, 0, 0 isometric coordinate - by default // this point would be at screen coordinates 0, 0 (top left) which is usually undesirable. game.iso.anchor.setTo(0.5, 0.5); }, create: function () { // Create a group for our tiles, so we can use Group.sort isoGroup = game.add.group(); isoGroup.enableBody = true; isoGroup.physicsBodyType = Phaser.Plugin.Isometric.ISOARCADE; // Set the global gravity for IsoArcade. game.physics.isoArcade.gravity.setTo(0, 0, -500); kentta = game.add.isoSprite(200,0,20,'kentta',0,isoGroup); kentta.anchor.setTo(0.5,0); game.physics.isoArcade.enable(kentta); kentta.body.immovable = true; kentta.moves = false; house = game.add.isoSprite(410,70,0,'house1',0,isoGroup); house.anchor.setTo(0.5); house2 = game.add.isoSprite(440,180,100,'house2',0,isoGroup); house2.anchor.setTo(0.5); house3 = game.add.isoSprite(440,250,100,'house2',0,isoGroup); house3.anchor.setTo(0.5); house4 = game.add.isoSprite(340,275,100,'house3',0,isoGroup); house4.anchor.setTo(0.5); house5 = game.add.isoSprite(500,275,100,'house5',0,isoGroup); house5.anchor.setTo(0.5); house6 = game.add.isoSprite(475,90,100,'house6',0,isoGroup); house6.anchor.setTo(0.5); park = game.add.isoSprite(330,140,80,'park',0,isoGroup); park.anchor.setTo(0.5); factory = game.add.isoSprite(240,270,80,'factory',0,isoGroup); factory.anchor.setTo(0.5); // Create another cube as our 'player', and set it up just like the cubes above. player = game.add.isoSprite(200, 0, 100, 'cube', 0, isoGroup); player.tint = 0x86bfda; player.anchor.set(0.5); game.physics.isoArcade.enable(house); game.physics.isoArcade.enable(house2); game.physics.isoArcade.enable(house3); game.physics.isoArcade.enable(house4); game.physics.isoArcade.enable(house5); game.physics.isoArcade.enable(house6); game.physics.isoArcade.enable(park); game.physics.isoArcade.enable(player); park.body.moves = false; park.body.immovable = true; factory.body.moves = false; factory.body.immovable = true; park.scale.setTo((game.width/kentta.width)*0.5); /*kentta.body.setSize(kentta.body.widthX*1.5,kentta.body.widthY,kentta.body.height*0.5);*/ player.body.collideWorldBounds = true; kentta.body.collideWorldBounds = true; house.body.collideWorldBounds = true; house2.body.collideWorldBounds = true; kentta.scale.setTo((game.width/kentta.width)*0.5); house.scale.setTo((game.width/kentta.width)*0.15); house2.scale.setTo((game.width/kentta.width)*0.15); house3.scale.setTo((game.width/kentta.width)*0.15); house4.scale.setTo((game.width/kentta.width)*0.15); house5.scale.setTo((game.width/kentta.width)*0.15); house6.scale.setTo((game.width/kentta.width)*0.15); factory.scale.setTo((game.width/kentta.width)*0.15); // Set up our controls. this.cursors = game.input.keyboard.createCursorKeys(); this.game.input.keyboard.addKeyCapture([ Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT, Phaser.Keyboard.UP, Phaser.Keyboard.DOWN, Phaser.Keyboard.SPACEBAR ]); var space = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); space.onDown.add(function () { player.body.velocity.z = 300; }, this); game.iso.projectionAngle = 0.575; //init once after endering is done setTimeout(function(){ /*kentta.body.setSize(1400,1400,60); kentta.pivot.y = -150;*/ house2.body.moves = false; house2.body.immovable = true; house3.body.moves = false; house3.body.immovable = true; house4.body.moves = false; house4.body.immovable = true; house5.body.moves = false; house5.body.immovable = true; house6.body.moves = false; house6.body.immovable = true; /* park.body.moves = false; park.body.immovable = true; house.body.moves = false; house.body.immovable = true;*/ house4.body.setSize(house4.body.widthX/0.3,house4.body.widthY/0.3*1.25,house4.body.height/0.3,0,-10); house5.body.setSize(house5.body.widthX/0.3,house5.body.widthY/0.3*1.25,house5.body.height/0.3,-5,-10); park.body.setSize(park.body.widthX/0.3*1.2,park.body.widthY/0.3*1.5,park.body.height/0.3*1.5,-15,-27); },1000); }, update: function () { // Move the player at this speed. var speed = 100; if (this.cursors.up.isDown) { player.body.velocity.y = -speed; } else if (this.cursors.down.isDown) { player.body.velocity.y = speed; } else { player.body.velocity.y = 0; } if (this.cursors.left.isDown) { player.body.velocity.x = -speed; } else if (this.cursors.right.isDown) { player.body.velocity.x = speed; } else { player.body.velocity.x = 0; } // Our collision and sorting code again. game.physics.isoArcade.collide(isoGroup); game.iso.topologicalSort(isoGroup); }, render: function () { game.debug.text("Move with cursors, jump with space!", 2, 36, "#ffffff"); game.debug.text(game.time.fps || '--', 2, 14, "#a7aebe"); isoGroup.forEach(function (tile) { game.debug.body(tile, 'rgba(189, 221, 235, 0.6)', false); }); } }; game.state.add('Boot', BasicGame.Boot); game.state.start('Boot'); If you're wondering why there is a stupid timeout function, that's because all buildings flickered if those where defined in create function. I have no idea why. kentta variable is the field. Here is the picture of my game, body of field is rather off, I know, I know.
×
×
  • Create New...