Jump to content

Render function not working


kgibson
 Share

Recommended Posts

I'm currently using version 2.4.4 Amador.

I'm trying to debug a sprite but can't seem to get render or debug to work.

I understand that phaser needs to be rendering using Phaser.CANVAS that I need to include the "render: render" function. 

My code looks like:

render: function() {
	game.debug.spriteInfo(sprite, 32, 32);
}

but I've also tried:

function render() {
	game.debug.spriteInfo(sprite, 32, 32);
}

Console log seems to suggest I'm creating the function the wrong way?

Thanks in advance!

 

Side note: my other main functions, preload, create, and update, all look like my first snippet and seem to work fine.

Link to comment
Share on other sites

Can you share the whole file using pastebin or something? Depending on how you've setup your game state, i.e: with prototype, objects etc.. then you'd make your method or function different accordingly. I write my functions like this:

render() {
    // -- //
}

 

Link to comment
Share on other sites

Well, you have a line in your code that says:

game.debug.spriteInfo(sprite, 32, 32);

However, you never define a variable called sprite.  You probably meant to debug steve, right? Try replacing the sprite with steve:

game.debug.spriteInfo(steve, 32, 32);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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