Giter Club home page Giter Club logo

Comments (7)

PhaserEditor2D avatar PhaserEditor2D commented on May 21, 2024 1

You can do that!

Look in the Compiler Scene Settings you can change the name of the method to preload the assets and create the objects. So, you can say the editor to generate a _preload method and a _create method, then, you can write your scene like this:

class Level extends Phaser.Scene {
	
	_preload() {
		// generated by the compiler

		this.load.pack(...)
	}

	_create() {
		// generated by the compiler

		this.add.image(...)
	}

	// start user code

	preload() {
		this._create();
		this._preload();
	}

	// end user code
}

from phasereditor2d-v3.

PhaserEditor2D avatar PhaserEditor2D commented on May 21, 2024

Please, can you write some code examples? I don't get what's your proposition.

from phasereditor2d-v3.

ItsGravix avatar ItsGravix commented on May 21, 2024

My proposition is to bring back this feature from Phaser Editor v1. Enabling a scene as a preloader will make it so all the sprites are created in the preload method.

preload() {
    this.add.sprite(0, 0, "phaser", "loading_dino");
}

https://help.phasereditor2d.com/v1/canvas.html?highlight=preload#preloader-state-configuration

from phasereditor2d-v3.

PhaserEditor2D avatar PhaserEditor2D commented on May 21, 2024

BTW, I just fixed an issue with the dialog to select the asset pack files to preload. I think I will do a point release with this fix. In the meantime, you can test it following these steps.

from phasereditor2d-v3.

PhaserEditor2D avatar PhaserEditor2D commented on May 21, 2024

Hi @ItsGravix

Is it find the solution I pointed in previous comments?

from phasereditor2d-v3.

ItsGravix avatar ItsGravix commented on May 21, 2024

@PhaserEditor2D Yes that solution works fine!

from phasereditor2d-v3.

PhaserEditor2D avatar PhaserEditor2D commented on May 21, 2024

Great, I am closing this.

from phasereditor2d-v3.

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.