Skip to content

How to position an UITextBubble? #112

Description

@Pattentrick

Hi there,

i have some trouble with the UITextBubble element. I want to spawn my text bubble at the position of my player. But when i do something like this:

// EntityTextOutput is my UITextBubble element
ig.game.spawnEntity( ig.EntityTextOutput, 100, 300 );

The text bubble will spawn at the top left corner of the canvas. Adding a performance: 'dynamic' to it will at least spawn it at the top left corner of the gameworld, but it's still ignoring the spawning coordinates mentioned above. Even adding a this.pos.x = 451 to the constructor does nothing.

So obviously i am doing this the wrong way. How do i position/spawn a text bubble at a desired location?

By the way, here is my constructor/class:

javascript
ig.module(
'game.entities.text-output'
)
.requires(
'plusplus.ui.ui-text-bubble',
'game.entities.text-output-content',
'plusplus.core.config'
)
.defines(function () {

var _c  = ig.CONFIG;

/**
 * Textoutput.
 *
 * @class
 * @extends ig.UITextBubble
 * @memeberof ig
 */
ig.EntityTextOutput = ig.global.EntityTextOutput = ig.UITextBubble.extend({

    cornerRadius: 10,

    triangleLength: 0,

    textSettings: {

        text: 'Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor',
        font: new ig.Font( _c.PATH_TO_MEDIA + 'command_preview_font.png' )

    }

});

});


Thanks for any help on this :-)   

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions