Over 16,537,361 people are on fubar.
What are you waiting for?

Alturos's blog: "Jungle Jim"

created on 12/09/2006  |  http://fubar.com/jungle-jim/b32902

The First PitFall

I had a pretty good idea of how the code should have worked. The first step was creating the Map File Scheme. I decided on an XML based file for its ease of use and editing. before long I had an acceptable template to build from. I built up the map structure and created my first mapfile through a utility that asked for input and serialized it into a file. Next came how to handle the map and get it drawn. I decieded I wanted to use GameComponents (an XNA object essentially) because they fit the bill exactly. I wanted to have a Map Component and an array of Screen Components. each screen component would have an array of components for Crocs, Ponds, Vines, Rolling Logs, and Holes. So I created the different components for each type of item and everything seemd to look good code wise, and the code Built. Running it however was a different matter. Everything seemed right in the code but I was taking Null reference exceptions all over the place. I did some debugging and was able to track down the problem but it didn't make sense. Initialize was never being called on my nested components. My first search did not turn up well, all I found was that Nested components were not supported. M ynext option was to post on the MSDN forums, so I did with my exact problem. Bascally what ended up being the case was that since I was adding components to the game AFTER the main call to initialize, which I was doing as I needed to load the map before I could initialize my sub components, Initialize was not automatically being called for my sub components. So I added a manual call to initialize and BAM code built and ran and I had a map with everything in it.
Leave a comment!
html comments NOT enabled!
NOTE: If you post content that is offensive, adult, or NSFW (Not Safe For Work), your account will be deleted.[?]

giphy icon
last post
17 years ago
posts
3
views
905
can view
everyone
can comment
everyone
atom/rss

recent posts

17 years ago
Update!
17 years ago
The First PitFall
17 years ago
The Beginning.
official fubar blogs
 8 years ago
fubar news by babyjesus  
 13 years ago
fubar.com ideas! by babyjesus  
 10 years ago
fubar'd Official Wishli... by SCRAPPER  
 11 years ago
Word of Esix by esixfiddy  

discover blogs on fubar

blog.php' rendered in 0.0552 seconds on machine '196'.