Game Development Community

whack a mole tutorial issue

by Harleyd · in Technical Issues · 09/21/2011 (6:33 pm) · 3 replies

Now let's create the methods of the respawnPoint class. The following functions go in respawnPoint.cs:

This is where I am confused it says to put the function in this file respawnpoint.cs only I dont see that file anywhere. What I copy and pasted at the top is the only directions that I see. this is located in the whack a mole tutorial (respawning the mole) about half way down the tutorial. I tried creating a new file in the gamescripts folder but that didnt work. Anybody?

#1
09/22/2011 (6:24 am)
You need to do the following:

1. Create the respawnpoint.cs text file
2. Add it to gamescripts
3. Call the exec() function on the script from another script to make sure it is parsed.
#2
09/22/2011 (10:32 am)
Michael thanks for replying but I am brand new to this so I am working solely from the tutorial so on your third instruction I have no idea what you are saying.I have done the first two parts of your reply already,now in the tutorial it says pretty much what you are saying in your third instruction I think, I'll copy it here: Create another script file named moleLevel.cs, exec() it in game.cs below the ones we have already done and type the following functions into it:

function moleLevel::onLevelLoaded(%this)
{
%this.respawnPointSet = new SimSet();
}


function moleLevel::onLevelEnded(%this)
{
%this.respawnPointSet.delete();
}
now from what I understand from the tutorial I added this piece of script to the main.cs file at the end of the script just above the game cleanup section. Is this correct please excuse my ignorance to this stuff I am trying to self teach myself and boy its not easy when you dont know anything about programming.
#3
11/30/2011 (3:43 pm)
@Harley4:
From the Whack-a-mole tutorial - Part 2 (close to top)

Quote:First, we will create a file for later. Add the bold text to your startGame() function in game.cs:

function startGame(%level)
{
   //exec game scripts
   exec("./mole.cs");
exec("./respawnPoint.cs"); <----


   // Set The GUI.
   Canvas.setContent(mainScreenGui);
   Canvas.setCursor(DefaultCursor);

   moveMap.push();


   // this has been added:
   sceneWindow2D.setUseObjectMouseEvents( true );

   if( isFile( %level ) || isFile( %level @ ".dso"))
      sceneWindow2D.loadLevel(%level);
}

Notice the line i signaled? that's what Michael is talking about