Code Monkey home page Code Monkey logo

Comments (4)

digitsensitive avatar digitsensitive commented on May 19, 2024

Hello @gnesher! Strings are accepted as valid for game height and width because you might want to use percentages (f.e. 60% width and 100% height). Even though I haven't used this yet, I would leave it. Is that what you meant?

Have a look at the official phaser code.

from phaser3-typescript.

gnesher avatar gnesher commented on May 19, 2024

Oh interesting. I've been following a simple tutorial (https://gamedevacademy.org/phaser-3-tutorial/) which tells you to put a sprite in the middle of the screen using this.sys.game.config.height / 2 which is now invalid. Not sure how to work around that except to manually cast these to number when I know the value

from phaser3-typescript.

digitsensitive avatar digitsensitive commented on May 19, 2024

That is true, this will be invalid. The best thing would be probably, that if you choose to use a string f.e. 20%, that the phaser framework would calculate the absolute size and save that as the width so you can access it with this.sys.game.config.height. Maybe something to discuss in the official phaser respository?

from phaser3-typescript.

digitsensitive avatar digitsensitive commented on May 19, 2024

@gnesher Are you going to open a discussion in the official phaser repository or will you leave it as it is?

from phaser3-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.