Hello Guest

Author Topic: 2D Toolkit Mole Tutorial Error  (Read 5084 times)

GigaTron

  • Newbie
  • *
  • Posts: 6
    • View Profile
2D Toolkit Mole Tutorial Error
« on: August 23, 2013, 04:03:58 am »
Hey guys I finally got 2DToolkit, but when adding the score Implementing but I got an error:

Assets/Scripts/ScoreScript.cs(36,38): error CS0103: The name `mole' does not exist in the current context


I'm new to programming so I'm not sure what to do. My mole object is called "Mole" and I changed it to that but I got the same error.

dm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: 2D Toolkit Mole Tutorial Error
« Reply #1 on: August 23, 2013, 06:54:33 am »
Maybe you forgot something like this

...
public Mole mole;
...

And drop mole object into this variable in the editor?

GigaTron

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: 2D Toolkit Mole Tutorial Error
« Reply #2 on: August 23, 2013, 07:05:57 am »
I just got another error:

Assets/Scripts/ScoreScript.cs(8,16): error CS0246: The type or namespace name `Mole' could not be found. Are you missing a using directive or an assembly reference?


Which game object would I attach it to? The tutorial doesn't say which object to attach it to.

gary-unikronsoftware

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 74
    • View Profile
Re: 2D Toolkit Mole Tutorial Error
« Reply #3 on: August 23, 2013, 09:12:24 am »
Did you put this line (or a one similar to it)...

Code: [Select]
ScoreScript.Score += mole.Whacked ? 0 : 10;
in the ScoreScript?  If so, that's why it's not working, it needs to go in the MainGameScript at the point where you detect a successful mole hit.