jsantos

Checking collisions - something is defined but not used

Recommended Posts

Hi all!

 

First off, let me say that MightyEditor is really really cool!

I'm enjoying a lot the graphic nature of it and how easy and quick it is to see something happening!

 

Now my problem:

When following along "Digger", at this moment:

this.game.physics.arcade.collide(this.character, this.blocks.self, function(character, block), null, this);

I ended up getting the error "character is defined but never used"... this has to do with passing character has an argument to the function, I think but how to solve it? 

 

Thanks in advance!

 

Cheers!

Share this post


Link to post
Share on other sites

hi,

 

you are missing function body in your pasted code. 

 

there should be something like:

this.game.physics.arcade.collide(this.character, this.blocks, function(character, block) {    console.log('Collision between', character, block);}, null, this);

function body part that you missed

 {    console.log('Collision between', character, block);} 

Share this post


Link to post
Share on other sites

Ahhhh!

 

Cheers Stauzs!!!

The video and the new tutorial - "SockMan" don't show it... 

 

So I need to use a console.log to "initialize/use" (let's say...) the character and the block arguments... this is kind of a "hack" right? Because (please correct me if I'm wrong) console.log has no other use than to display something... Nice, I like it! ;)

 

Now it's working! Many thanks!

Share this post


Link to post
Share on other sites

 

So I need to use a console.log to "initialize/use" (let's say...) the character and the block arguments... this is kind of a "hack" right? Because (please correct me if I'm wrong) console.log has no other use than to display something... Nice, I like it! ;)

 

No - you don't need console log :) , it is just an example. You had incomplete function definition.

Follow tutorial and everything should get clear.

 

SockMan tutorial is not on our site, but on gamesfromscratch: 

http://www.gamefromscratch.com/post/2014/10/12/Guest-Tutorial-Creating-a-Game-Using-MightyEditor-and-Phaser.aspx

link works for me

Share this post


Link to post
Share on other sites

Mmmm... ok!

 

I was indeed following it but it just worked after your console.log and/or after adding the destroyBlocks method.

The rest of the time whenever Guntis pressed open Game mine would just get stuck!  :(

 

But no worries, it is working and I see what you mean about defining the function!

 

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.