• Content Count

  • Joined

  • Last visited

Posts posted by TrinityCore

  1. 3 hours ago, samme said:
    var poster =;
    var tooltip = poster.add(*...*/));
    var title = poster.add(this.add.text(/*...*/));
    var description = poster.add(this.add.text(/*...*/));
    // ...


    Thanks! its cool! 😁

  2. 13 hours ago, samme said:

    Use a Group instead, with add and destroy(true).

    Maybe I have not explained myself well.

    ¿What i need?

    I need to create a "cosmic" object that is capable of containing many other objects of all kinds.
    To thus "Modulate" an object and that it acts as the total thereof.
    Making that ... when eliminating the "Cosmic Object", all the objects belonging to it are also eliminated.

    ¿is it possible?

  3. Hey guys!

    I would like to know how I could remove a set of objects without needing to do it 1 to 1

    ¿why is this?

    I have created one poster, and this consist of 4 parts: Background, title, image and description.

    When I need to remove this object, it turns out that only the background is removed, but everything else remains.

    My Code:

    this.Tooltip =;
    this.Tooltip.beginFill(0xffffff, 1);
    this.Tooltip.drawRect(10, 10, 500, 250);
    this.Tooltip.wanted = {
    	title: Game.PhaserGame.add.text(0, 0, "¡WANTED!", {font: "bold 32px Arial", boundsAlignH: "center", boundsAlignV: "top", fill: "red"}),
    	//image: Game.PhaserGame.add.sprite(0, 0, 250, 200, "wanted"),
    	description: Game.PhaserGame.add.text(0, 0, "We are looking for this man", {font: "bold 16px Arial", boundsAlignH: "center", boundsAlignV: "middle", fill: "red"})
    this.Tooltip.wanted.title.setTextBounds(10, 10, 500, 250);
    this.Tooltip.wanted.description.setTextBounds(10, 10, 500, 250);

    As you can see, what I need is to create a "parent" object that contains all the information so that when the object is deleted, it is deleted in its entirety, that is, I do not want it to be there (not hidden, deleted).

    ¿Is this possible?

  4. Hi Guys!

    I have a problem when i create a new "Phaser.Game".

    The problem is that when i run the game, this is using other dimension that i haven't spesified in the code. ¿any solution?


    The code is very simple:

    this.PhaserGame = new Phaser.Game(1200, 650, Phaser.AUTO, "canvas", null, false, true, Phaser.Physics.ARCADE);

    Thanks to all for your time.

  5. Hey Guys!


    I just created a very simple physics editor since the one we use commonly gets paid and it's only free for a while.

    The truth, as I said, is very simple, just add the image, the groups of polygons needed for that image and then in each group we can add individual polygons at the position of the cursor with the key [1] to make it easier and fast.

    After this we export and ready.

    Here are some pictures:






    If there is a problem or something that should be taken into account to improve this system, I would appreciate it if they told me.


  6. 3 hours ago, ncil said:

    Hello! I think the problem is with your actual button image file. The frames should go from left to right, not top to bottom. So your image should be 216x48 pixels. Try that.

    No, the image is fine, the problem was that it was loading two identical files, one in the preload state and another in the state of MainMenu, which caused a kind of strange update.

  7. 3 hours ago, ncil said:

    I don't know if this is contributing to the problem, but something I noticed is that you are loading two different image assets that have the same key of "Background". Once in the preload function and then again in the preloaders function. Try changing one of those to something else and see what happens.

    Yes, that was the mistake, thank you!

  8. Hello Guys


    I have a problem with the buttons on phaser

    They do not change the texture as indicated in the code


    var PhaserGame = new Phaser.Game(1200, 640, Phaser.AUTO, "PhaserGame");
    var Preload;
    var MainMenu;
    PhaserGame.state.add("Preload", Preload);
    PhaserGame.state.add("MainMenu", MainMenu);


    Preload = {
    	preload: function(){
    	create: function(){
    		PhaserGame.load.onLoadComplete.add(Finished, this);
    	update: function(){},
    function Preloaders(){
    	PhaserGame.load.image("Background", "./images/Assest/Background001.png");
    	PhaserGame.load.spritesheet("Button", "./images/Buttons/Button.png", 108, 48);
    function Finished(){


    MainMenu = {
    	preload: function(){
    	create: function(){
    		Background = PhaserGame.add.tileSprite(0, 0, 1200, 640, "Background");
    		Button = PhaserGame.add.button(10, 10, "Button", Tester, this, 0, 1);
    	update: function(){
    function Tester(object){

    The button does not change texture, and the mouse cursor changes state: Normal to Pointer, but steadily at the slightest movement on the button (without even getting out of it).

    What could be the reason for this error?



    I have tried with the following things:

    1- Download the library again (Version 2.7.7).

    2- Restart my computer.

    3- Delete history, cookies, and everything that can be removed (Completely everything!).

    4- Create all states from scratch.

    What I can be doing wrong?


    I hope you can help me.

  9. Hello Guys!

    I want to know why this error is coming out:

    phaser.js:17481 Uncaught TypeError: Cannot read property 'compressionAlgorithm' of null
    at PIXI.WebGLRenderer.updateTexture (phaser.js:17481)
    at PIXI.WebGLSpriteBatch.renderBatch (phaser.js:18911)
    at PIXI.WebGLSpriteBatch.flush (phaser.js:18890)
    at PIXI.WebGLSpriteBatch.renderTilingSprite (phaser.js:18629)
    at Phaser.TileSprite._renderWebGL (phaser.js:60299)
    at Phaser.World.PIXI.DisplayObjectContainer._renderWebGL (phaser.js:15056)
    at Phaser.Stage.PIXI.DisplayObjectContainer._renderWebGL (phaser.js:15056)
    at PIXI.WebGLRenderer.renderDisplayObject (phaser.js:17377)
    at PIXI.WebGLRenderer.render (phaser.js:17343)
    at Phaser.Game.updateRender (phaser.js:35041)

    this is my code:

    Preload = {
    	preload: function(){
    		PhaserGame.load.image("Background", "./img/Preload.jpg");
    		PhaserGame.load.image("LoadingFrame", "./img/Loading/LoadingFrame.png");
    		PhaserGame.load.image("Loading", "./img/Loading/LoadingBar.png");
    	create: function(){
    		// INTERFAZ //
    		this.Background = PhaserGame.add.image(0, 0, "Background");
    		PhaserGame.scale.pageAlignHorizontally = true;
    		this.LoadingBar = PhaserGame.add.tileSprite(PhaserGame.width/2-(416), PhaserGame.height/2-(26-80), 832, 52, "Loading");
    		this.LoadingBar.width = 0;
    		this.LoadingFrame = PhaserGame.add.image(this.LoadingBar.position.x, this.LoadingBar.position.y, "LoadingFrame");
    		this.LoadingPercentage = PhaserGame.add.text(0, 0, "", {font: "bold 18px Arial"});
    		this.LoadingPercentage.addColor("#000000", 0);
    		// EVENTOS //
    		PhaserGame.load.onLoadStart.add(this.Start, this);
    		PhaserGame.load.onFileComplete.add(this.Loading, this);
    		PhaserGame.load.onLoadComplete.add(this.Finished, this);
    	update: function(){},
    	Preloaders: function(){
    		PhaserGame.load.image("Background", "./img/Assest/Background001.png");
    		PhaserGame.load.image("BarFrame", "./img/Assest/BarFrame.png");
    		PhaserGame.load.image("BlueBar", "./img/Assest/BlueBar.png");
    		PhaserGame.load.image("RedBar", "./img/Assest/RedBar.png");
    		PhaserGame.load.image("GreenBar", "./img/Assest/GreenBar.png");
    		PhaserGame.load.image("Coin", "./img/Assest/Coin.png");
    		PhaserGame.load.image("Energy", "./img/Assest/Energy.png");
    		PhaserGame.load.image("Star", "./img/Assest/Star.png");
    		PhaserGame.load.image("StatusBar001", "./img/Assest/StatusBar001.png");
    		PhaserGame.load.image("StatusBar002", "./img/Assest/StatusBar002.png");
    		PhaserGame.load.image("StatusBar003", "./img/Assest/BarFrame.png");
    		PhaserGame.load.image("Lock", "./img/Assest/Lock.png");
    		PhaserGame.load.image("Unlock", "./img/Assest/BarFrame.png");
    		PhaserGame.load.image("Health001", "./img/Assest/Health001.png");
    		PhaserGame.load.image("Health002", "./img/Assest/Health002.png");
    		PhaserGame.load.image("Health003", "./img/Assest/Health003.png");
    		// BOTONES //
    		PhaserGame.load.spritesheet("Button002", "./img/Buttons/002.png", 108, 48);
    	Start: function(){
    		this.LoadingPercentage.text = "Preparing...";
    		this.LoadingPercentage.position.x = this.LoadingFrame.position.x+(this.LoadingFrame.width/2-(this.LoadingPercentage.width/2));
    		this.LoadingPercentage.position.y = this.LoadingFrame.position.y+(this.LoadingFrame.height/2-(this.LoadingPercentage.height/2));
    	Loading: function(progress){
    		this.LoadingBar.width = 832*progress/100;
    		this.LoadingPercentage.text = progress+"%";
    		this.LoadingPercentage.position.x = this.LoadingFrame.position.x+(this.LoadingFrame.width/2-(this.LoadingPercentage.width/2));
    		this.LoadingPercentage.position.y = this.LoadingFrame.position.y+(this.LoadingFrame.height/2-(this.LoadingPercentage.height/2));

    This is the line of the error:

    this.Background = PhaserGame.add.image(0, 0, "Background");

    If that line is commented, do not throw mistakes

    Why is this?

  10. Hello!


    I have compiled my phaser game using but at the time of installing it, I only install an application where I must enter the url or zip of the game. But I just want you to install the game and now ... ¿How can I do?

    That is, I just want the game to be installed, that when entering either the game and not that interface to debug ¿Any ideas?


    Thanks and regards!


  11. On 18/6/2017 at 8:45 AM, Tom Atom said:

    It is sometimes hard to get on well with Phaser+P2 ... What P2 does is it calculates center of mass and places anchor into it - both your obejcts have x = 500 and both are centered around this point.

    In past I had to come up with some solution that allows me to place objects where I want it with anchor which I need. I described it in detail here - it was answer to scaling P2 objects, but solution is complex enough to handle "everything" - scaling, anchoring, positioning:


    I get it...

    Basically managing P2 is to handle physics in its complexity.
    I still do not have what it takes to do it, so I just have to make a small calculation to get the x-y point of the real image and place it in the real position.

    Thanks and regards!

  12. Hello

    I would like to know how to fix this problem regarding the positions of objects in phaser with Physics P2.

    When placing two objects in the same position "X", each one takes a distinct position, but still phaser indicates that those objects are in the same position "X" being this incorrect.

    To avoid confusion I have highlighted one of the objects.

    Image: Click Here

    For Example:

    These are the two objects used in the previous image:

    1- Object 1

    2- Object 2

    I hope that the one who reads this post, know in advance that the dimensions of each of the objects has nothing to do with this problem.

    To finish I want to add that the platform where these two objects are located is in position 1200, which would be the height of the map, which is also very bad, since when placing any object in position 1200 that is the limiting part of the Map , These objects should not be visibles

    // Game //
    PhaserGame = new Phaser.Game(1200, 650, Phaser.AUTO, "PhaserGame");
    // World Bounds //, 0, 5000, 1200);
    // Background //
    Background = PhaserGame.add.tileSprite(0, 0, 5000, 1200, "BackgroundLevel1");
    // Objects //
    PhaserObject =;
    PhaserObject.enableBody = true;
    PhaserObject.physicsBodyType = Phaser.Physics.P2JS;
    CreateObject(0, 1200, 256, 0, "Plataforma001", "", "", PhaserObjects.length+24, "PlataformasBase");
    CreateObject(500, 1200-(128-17), 0, 0, "Plataforma002", "PlataformasP2", "plataforma002", PhaserObjects.length+1, "PlataformasAdicionales");
    CreateObject(500, 1200-(128-17), 0, 0, "Plataforma008", "PlataformasP2", "plataforma008", PhaserObjects.length+1, "PlataformasAdicionales");
    function CreateObject(x, y, IncX, IncY, key, keyPolygon, keyPolygonInternal, count, group){
    	for(var i = PhaserObjects.length; i < count; i++){
    	    PhaserObjects[i] = PhaserObject.create(x, y, key);
    		PhaserObjects[i].Group = group;
    		PhaserGame.physics.p2.enable([PhaserObjects[i]], false);
    		if(keyPolygon != '' || keyPolygonInternal != ''){
    			PhaserObjects[i].body.loadPolygon(keyPolygon, keyPolygonInternal);
    		PhaserObjects[i].body.static = true;
    		PhaserObjects[i].body.collides([PhaserObjectCollision, PlayerCollision]);
    		PlatformMaterial[i] = PhaserGame.physics.p2.createMaterial('PlatformMaterial', 
    		x += IncX;
    		y += IncY;

    I hope you can give me an indication of what is happening here, thank you!



  13. On 25/11/2016 at 7:16 AM, CharlesCraft50 said:

    @dami5200 Oh, remove the immovable and moves in your code because it is only for arcade, you choose what you want in this code, this code is for p2 physics which you are using:

    //To make it immovable: 
    casa.body.static = true;
    //If you just want to ignore the gravity, use this: 0;
    //With this, the body can't be moved by any other bodies: 
    casa.body.kinematic = true;


    Perfect, so far the truth that everything works well.
    Now, how to do so that the player does not turn when hitting the house?

    before: Before collision of the element

    After: After collision of the element

    And also to remove those lines and the color of the elements.


    And really thank you for answering my questions, which have helped me a lot!


  14. 10 hours ago, CharlesCraft50 said:

    @dami5200 Try this:

    house.body.immovable = true;
    house.body.moves = false;

    Does not work...


    var controles;
    Level2 = {
    	preload: function(){
    		game.load.spritesheet("player", "../images/characters/char1.png", 32, 48);
    		game.load.image("casa", "../images/casa.png");
    		game.load.physics("casajson", "../images/casa.json");
    	create: function(){
    		casa = game.add.sprite(500, 200, "casa");
    		player = game.add.sprite(200, 200, "player");
    		game.physics.p2.enable([player, casa], true);
    		casa.body.loadPolygon('casajson', 'casa');
    		casa.body.immovable = true;
    		casa.body.moves = false;
    		controles = game.input.keyboard.createCursorKeys();
    	update: function(){
    		player.body.velocity.x = 0;
    		// Condiciones de movimientos.
    			player.body.velocity.x = -200;"left");
    			PlayerFrame = 7;
    		}else if(controles.right.isDown){
    			player.body.velocity.x = 200;"right");
    			PlayerFrame = 6;
    			player.body.velocity.x = 0;
    			player.frame = PlayerFrame;


    Here is the image: image

  15. 8 hours ago, CharlesCraft50 said:

    If you already enabled it and still didn't work, just paste your whole code in this link so I can recognize what is the problem in your code: or
    Don't forget to send the link of your code.

    Thank you, it has served me.

    But another doubt ...

    How to immovable polygon image?

    house.body.immovable = true; -> It does not work, the house goes flying

  16. Hello guys!

    I must mention that I am new, and that I am Latin, so sorry for my English.


    Okay.. my question is the following.

    How to collision normal image and polygonal image.?
    What a clash with each other.


    In short, that's what I need to know.


    I hope you can help me, thank you all!. :)