Tabnine Logo For Javascript
Body
Code IndexAdd Tabnine to your IDE (free)

How to use
Body
in
phaser

Best JavaScript code snippets using phaser.Body(Showing top 5 results out of 315)

origin: geckosio/phaser-on-nodejs

constructor(scene, x, y) {
  // pass empty string for the texture
  super(scene, x, y, '')

  scene.add.existing(this)
  scene.physics.add.existing(this)

  // set the width and height of the sprite as the body size
  this.body.setSize(32, 48)
 }
origin: geckosio/phaser-on-nodejs

it('should multiply to 528 (24*22)', done => {
 class MainScene extends Phaser.Scene {
  preload() {
   this.load.image('star', '../assets/star.png')
  }

  create() {
   const star = this.physics.add.sprite(400, 300, 'star')
   expect(star.body.width * star.body.height).toBe(528)
   done()
  }
 }

 StartTest([MainScene])
})
origin: geckosio/phaser-on-nodejs

it('body size should be 32 * 48 (1536)', done => {
 class Player extends Phaser.Physics.Arcade.Sprite {
  constructor(scene, x, y) {
   // pass empty string for the texture
   super(scene, x, y, '')

   scene.add.existing(this)
   scene.physics.add.existing(this)

   // set the width and height of the sprite as the body size
   this.body.setSize(32, 48)
  }
 }

 class MainScene extends Phaser.Scene {
  create() {
   this.player = new Player(this, 100, 100)
  }

  update(time, delta) {
   expect(this.player.body.width * this.player.body.height).toBe(1536)
   done()
  }
 }

 StartTest([MainScene])
})
origin: geckosio/phaser-on-nodejs

this.player.body.setSize(24, 38)
if (this.player.body.onFloor()) {
 done()
origin: geckosio/phaser-on-nodejs

it('should multiply to 1536 (32*48)', done => {
 class MainScene extends Phaser.Scene {
  preload() {
   this.load.spritesheet('dude', '../assets/dude.png', {
    frameWidth: 32,
    frameHeight: 48,
   })
  }

  create() {
   const dude = this.physics.add.sprite(100, 450, 'dude')
   expect(dude.body.width * dude.body.height).toBe(1536)
   done()
  }
 }

 StartTest([MainScene])
})
phaser(npm)Body

Most used phaser functions

  • LoaderPlugin.image
  • LoaderPlugin.tilemapTiledJSON
  • ScenePlugin.start
  • AnimationManager.create
  • AnimationManager.generateFrameNames
  • ArcadePhysics.add,
  • Body.height,
  • Body.onFloor,
  • Body.setSize,
  • Body.width,
  • Factory.collider,
  • Factory.sprite,
  • Game,
  • Game.Game,
  • GameObjectCreator.tilemap,
  • GameObjectFactory.text,
  • HEADLESS,
  • LoaderPlugin.atlas,
  • LoaderPlugin.spritesheet

Popular in JavaScript

  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • body-parser
    Node.js body parsing middleware
  • glob
    a little globber
  • mongodb
    The official MongoDB driver for Node.js
  • express
    Fast, unopinionated, minimalist web framework
  • aws-sdk
    AWS SDK for JavaScript
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • commander
    the complete solution for node.js command-line programs
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now