Jump to content

Cannot view sprite render/debug


Gamma
 Share

Recommended Posts

Hello again everyone. I'm having trouble with trying to look at my characters collision box. I was looking at this example and I implemented the offset collision to my character, the problem is viewing how it looks like just like in the example. I am currently using the basic template provided on Github, and it doesn't seem to incorporate a render function. I tried to add one, but I kept getting errors. 

 

 

Link to comment
Share on other sites

Yes I have:

basicGame.Game = function(game) {    //	When a State is added to Phaser it automatically has the following properties set on it, even if they already exist:    this.game; //	a reference to the currently running game    this.add; //	used to add sprites, text, groups, etc    this.camera; //	a reference to the game camera    this.cache; //	the game cache    this.input; //	the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it)    this.load; //	for preloading assets    this.math; //	lots of useful common math operations    this.sound; //	the sound manager - add a sound, play one, set-up markers, etc    this.stage; //	the game stage    this.time; //	the clock    this.tweens; //	the tween manager    this.world; //	the game world    this.particles; //	the particle manager    this.physics; //	the physics manager    this.rnd; //	the repeatable random number generator    //	You can use any of these from any function within this State.    //	But do consider them as being 'reserved words', i.e. don't create a property for your own game called "world" or you'll over-write the world reference.};

Also, may I note that my index.html file does not have "render" in it at all: 

window.onload = function() {	//	Create your Phaser game and inject it into the gameContainer div.	//	We did it in a window.onload event, but you can do it anywhere (requireJS load, anonymous function, jQuery dom ready, - whatever floats your boat)	var game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameContainer');	//	Add the States your game has.	//	You don't have to do this in the html, it could be done in your Boot state too, but for simplicity I'll keep it here.	game.state.add('Boot', BasicGame.Boot);	game.state.add('Preloader', BasicGame.Preloader);	game.state.add('MainMenu', BasicGame.MainMenu);	game.state.add('Game', BasicGame.Game);	//	Now start the Boot state.	game.state.start('Boot');};

There doesn't seem to be a render function or "this.debug" in the template. How do I implement one? I noticed in tutorials that people implement this line of code, and when they call a render or debug method it would pop up seamlessly:

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render:render }); 

Thank you both for sticking around to help. Please feel free to assist me with this problem, I will also make an effort to fix this up myself as well. 

Link to comment
Share on other sites

Try updating to phaser v1.1.6 and then try it on IE 9+ or safari. for some reason the "this.game.debug.renderPhysicsBody(player.body);"  only works on IE and safari and not in chrome or firefox for me.  

 

I'll look into updating to the new version soon. Thank you for your help xdiepx. I appreciate it. And yes I have been using Chrome this whole time. 

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...