kandi background
Explore Kits

phaser | fast 2D game framework for making HTML5 games | Game Engine library

 by   photonstorm JavaScript Version: 3.55.2 License: MIT

 by   photonstorm JavaScript Version: 3.55.2 License: MIT

kandi X-RAY | phaser Summary

phaser is a JavaScript library typically used in Telecommunications, Media, Media, Entertainment, Gaming, Game Engine, Three.js, WebGL applications. phaser has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i @jwhite0042/phaser-ce' or download it from GitHub, npm.
Phaser is a fast, free, and fun open source HTML5 game framework that offers WebGL and Canvas rendering across desktop and mobile web browsers. Games can be compiled to iOS, Android and native apps by using 3rd party tools. You can use JavaScript or TypeScript for development. Along with the fantastic open source community, Phaser is actively developed and maintained by Photon Storm. As a result of rapid support, and a developer friendly API, Phaser is currently one of the most starred game frameworks on GitHub. Thousands of developers from indie and multi-national digital agencies, and universities worldwide use Phaser. Take a look at their incredible games. Visit: The Phaser website and follow on Phaser Twitter Play: Some of the amazing games #madewithphaser Learn: API Docs, Support Forum and StackOverflow Code: 1770+ Examples (source available in this repo) Read: The Phaser World Newsletter Discord: Join us on Discord Extend: With Phaser Plugins Be awesome: Support the future of Phaser.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • phaser has a medium active ecosystem.
  • It has 33496 star(s) with 6895 fork(s). There are 1230 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 72 open issues and 3961 have been closed. On average issues are closed in 205 days. There are 4 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of phaser is 3.55.2
phaser Support
Best in #Game Engine
Average in #Game Engine
phaser Support
Best in #Game Engine
Average in #Game Engine

quality kandi Quality

  • phaser has 0 bugs and 0 code smells.
phaser Quality
Best in #Game Engine
Average in #Game Engine
phaser Quality
Best in #Game Engine
Average in #Game Engine

securitySecurity

  • phaser has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • phaser code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
phaser Security
Best in #Game Engine
Average in #Game Engine
phaser Security
Best in #Game Engine
Average in #Game Engine

license License

  • phaser is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
phaser License
Best in #Game Engine
Average in #Game Engine
phaser License
Best in #Game Engine
Average in #Game Engine

buildReuse

  • phaser releases are available to install and integrate.
  • Deployable package is available in npm.
  • Installation instructions are not available. Examples and code snippets are available.
phaser Reuse
Best in #Game Engine
Average in #Game Engine
phaser Reuse
Best in #Game Engine
Average in #Game Engine
Top functions reviewed by kandi - BETA

kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here

Get all kandi verified functions for this library.

Get all kandi verified functions for this library.

phaser Key Features

Cerebral Fix

MoPub

Facebook

Game Distribution

GameCommerce

Mozilla

Texture Packer

TwilioQuest

Poki

CrazyGames

Lagged

Nakama

Clone the git repository via https, ssh or with the GitHub Windows or Mac clients.

Download as zip

Download the build files: phaser.js and phaser.min.js

phaser Examples and Code Snippets

See all related Code Snippets

Community Discussions

Trending Discussions on phaser
  • How to read position x of Shape Object when during tween
  • adding a property in a class inside d.ts file inside node_modules typescript
  • How can I properly scale Phaser sprites?
  • player object undefined only in update()ƒ
  • Getting last element on click every time in Javascript loop with Phaser JS
  • Integrate Phaser Game with React as component
  • Phaser 3 increase drag click area size of sprite
  • Moving the character a few tiles more seems to cause the whole scene (the physics world) to shake, why is that? How do I fix it?
  • Phaser 3 How to Access and Affect Player in Collision between 2 Objects Not Involving Player
  • Webpack Define plugin replacement is evaluated but not injected
Trending Discussions on phaser

QUESTION

How to read position x of Shape Object when during tween

Asked 2022-Apr-16 at 11:58

I have the Circle object that extends shape and am trying to get the value of x or position of the object in 2d plane. During animation (tween) the position does not update and remains static. How do i fix this ?

export class Circle extends Phaser.GameObjects.Shape {
    tween;
    constructor(scene:Phaser.Scene, x, y) {
        super(scene);
        let enemy = scene.add.circle(x, y, 20);
        enemy.setStrokeStyle(1, 0x05F9FB);
    
        this.tween = scene.tweens.add({
            targets: enemy,
            x: 560,
            y: 200,
            ease: 'Power1',
            duration: 3000,
            yoyo: true,
            repeat: -1
        });
    }
}

I have the below method in update method and it always returns original x value not the update one during tween.

update() {
    //Always returns  the orginal position of x and not the updated or current state of x
    console.log(enemy.x);
}

ANSWER

Answered 2022-Apr-16 at 11:58

The enemy position x and y is not the position of the circle, that is used in the tween. An easy option is, just to create a property, so that you can acess the position, from the property.

Here small example, how the access could work:

// Minor formating for stackoverflow
document.body.style = "display: flex;flex-direction: column;";    

class Circle extends Phaser.GameObjects.Shape {
    constructor(scene, x, y) {
        super(scene, x, y);
        this.circle = scene.add.circle(x, y, 20);           
        this.circle.setStrokeStyle(3, 0x05F9FB);
    
        this.tween = scene.tweens.add({
            targets: this.circle,
            x: 400,
            y: 120,
            duration: 3000,
            yoyo: true,
            repeat: 3
        });
    }
}

var config = {
    type: Phaser.AUTO,
    width: 536,
    height: 163,
    scene: {
        create,
        update
    }
}; 

function update(){
    this.info.setText(`x: ${this.enemy.circle.x.toFixed(0)}\ny: ${this.enemy.circle.y.toFixed(0)}  `);
}

function create () {
    this.enemy =  new Circle(this, 100, 100);
    this.info = this.add.text(20,20, '', 0xffffff);
}

var game = new Phaser.Game(config);
<script src="https://cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js">
</script>

Update:

Info: To keep the code cleaner using a getter( and setter) or method might be cleaner

Like this

 class Circle extends Phaser.GameObjects.Shape {
     ...
     getPosition(){
         let { x, y } = this.circle;
         return { x, y };
     }
 }

Source https://stackoverflow.com/questions/71885987

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install phaser

You can install using 'npm i @jwhite0042/phaser-ce' or download it from GitHub, npm.

Support

Go to https://newdocs.phaser.io/ to read the docs online using our brand new interface. Use the links to navigate the namespaces, classes and Game Objects lists and also use the new search box. The documentation for Phaser 3 is an on-going project. Please help us by contributing improved docs and examples.

Find more information at:

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 650 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases
Explore Kits

Save this library and start creating your kit

Install
Clone
  • https://github.com/photonstorm/phaser.git

  • gh repo clone photonstorm/phaser

  • git@github.com:photonstorm/phaser.git

Share this Page

share link
Reuse Pre-built Kits with phaser
Consider Popular Game Engine Libraries
Try Top Libraries by photonstorm
Compare Game Engine Libraries with Highest Support
Compare Game Engine Libraries with Highest Quality
Compare Game Engine Libraries with Highest Security
Compare Game Engine Libraries with Permissive License
Compare Game Engine Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 650 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases
Explore Kits

Save this library and start creating your kit