Jump to content

oop with pixi --beginner question


espace
 Share

Recommended Posts

//text.js above main.js in my index.html
var e = function() {

var style = {
    font : ' 36px Luckiest Guy',
    fill : '#F7EDCA',
    dropShadowColor : '#000000',
    dropShadowAngle : Math.PI / 6,
    dropShadowDistance : 6,
    //wordWrap : true,
   //wordWrapWidth : 1000,
    //LineHeight : 4,
};

e.body = new PIXI.Text('level ',style)
e.body.anchor.x=.5
e.body.anchor.y=.5
e.body.x=50
e.body.y=100

}

//main.js below text.js in my index.html

var stage = new PIXI.Container();
var interactive=true
stage.interactive =true ;	

// create a renderer instance
var renderer = PIXI.autoDetectRenderer(320, 480);

// add the renderer view element to the DOM
document.body.appendChild(renderer.view);

requestAnimationFrame( animate );

var hud = e()

stage.addChild(hud);

function animate() {

	requestAnimationFrame( animate );

	// render the stage   
	renderer.render(stage);
}

Hi, i don't knwo how to set correctly my text.js to be used as a OOP object. 

I can't see my text who is hud in my main.js....why ?

I take the example of a text but it could be a rectangle or something else...

Thanks for your response.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...