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

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

  • Recently Browsing   0 members

    No registered users viewing this page.