Jump to content
• Advertisement

Public Group

# Recursive Methods

This topic is 2777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi,

I am currently working on Nick Gravelyn's tile editor but I am stuck on episode 5 (Recursive Methods). Would you be able to point out to me where I am going wrong? I seem to get out of bounds exception errors when I try to use the 'fill' option. The error is quite different than the one he highlights in the video. I cannot progress with these tutorials (which I would like to) until I resolve this.

My project is here, if you wish to take a look at it:
https://skydrive.liv...89BB32BAF8D!134

I would greatly appreciate any help you can give to me. Thanks for taking the time to read this.

Regards,
Darren

#### Share this post

##### Share on other sites
Advertisement
Could you be a bit more specific on where you are stuck and why you are stuck..

What error message do you get?

#### Share this post

##### Share on other sites
I am having particular problems with the FillCell method in the Form1.cs in the TileEngine class.

 public void FillCell(int x, int y, int desiredIndex) { int oldIndex = currentLayer.GetCellIndex(x, y); currentLayer.SetCellIndex(x, y, desiredIndex); if (x > 0 && currentLayer.GetCellIndex(x - 1, y) == oldIndex) FillCell(x - 1, y, desiredIndex); if (x < currentLayer.Width - 1 && currentLayer.GetCellIndex(x + 1, y) == oldIndex) FillCell(x + 1, y, desiredIndex); if (y > 0 && currentLayer.GetCellIndex(x, y - 1) == oldIndex) FillCell(x, y - 1, desiredIndex); if (y < currentLayer.Height - 1 && currentLayer.GetCellIndex(x, y + 1) == oldIndex) FillCell(x, y + 1, desiredIndex); } 

It just seems to be finding tiles outside of the array all of the time. Which breaks the program. The fill feature seems to be used again in the next few videos, so I can';t move on until it works.

#### Share this post

##### Share on other sites
i watched the next episode of the tutorial. That will explain in detail what type of error you are gettting and how to solve it!

#### Share this post

##### Share on other sites
Continue on to pt 2/3

EDIT** Beat to the punch!

#### Share this post

##### Share on other sites

• Advertisement
• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• ### Popular Now

• 11
• 23
• 36
• 16
• 75
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!