Jump to content

Search the Community

Showing results for tags 'four direction sprite'.

  • 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. /* when i move sprite with keyboard, phaser not remember the last frame of direction. and frame are broken. */ import store from './core/utilitises/store.js'; const GAME = new Phaser.Game( 800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render }); function preload(){ GAME.load.image('background','asset/images/background/grid-1920x1920.png'); // name sprite - image source sprite - width sprite - height sprite - number image GAME.load.spritesheet('player', 'asset/images/heroes/@skytrue.png', 48, 66, 32); } function create(){ GAME.add.tileSprite(0, 0, 1920, 1920, 'background'); GAME.world.setBounds(0, 0, 1920, 1920); GAME.physics.startSystem(Phaser.Physics.P2JS); store.player = GAME.add.sprite(GAME.world.centerX, GAME.world.centerY, 'player'); GAME.physics.p2.enable(store.player); store.player.animations.add('down', [0,1,2,3,4,5,6,7], 8, true, true); store.player.animations.add('left', [8,9,10,11,12,13,14,15], 8, true, true); store.player.animations.add('right', [16,17,18,19,20,21,22,23], 8, true, true); store.player.animations.add('up', [24,25,26,27,28,29,30,31], 8, true, true); store.cursors = GAME.input.keyboard.createCursorKeys(); GAME.camera.follow(store.player); } function update(){ store.player.body.setZeroVelocity(); if (store.cursors.up.isDown) { store.player.body.moveUp(100) store.player.animations.play('up'); } else if (store.cursors.down.isDown) { store.player.body.moveDown(100); store.player.animations.play('down'); } else if (store.cursors.left.isDown) { store.player.body.moveLeft(100) store.player.animations.play('left'); } else if (store.cursors.right.isDown) { store.player.body.moveRight(100); store.player.animations.play('right'); } else { store.player.animations.stop(); store.player.frame = 0 } } function render(){ } console.log(GAME, "test")
×
×
  • Create New...