Just a quick question

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
deathsangel
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Apr 18, 2009 8:17 pm

Just a quick question

Post by deathsangel »

Can you guys tell me if this is a good approach for making a tile engine?

I created a layer class which loads the file, and turns it into a layer.
Then I have a map class which stores layers.
Finally in my draw code I call map.draw() which loops through all the layers in that map and draws them.

So can you guys please tell me if this is a good approach, and if it is not please tell me what I should do instead?
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine :)
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Just a quick question

Post by K-Bal »

deathsangel wrote:Can you guys tell me if this is a good approach for making a tile engine?

I created a layer class which loads the file, and turns it into a layer.
Then I have a map class which stores layers.
Finally in my draw code I call map.draw() which loops through all the layers in that map and draws them.

So can you guys please tell me if this is a good approach, and if it is not please tell me what I should do instead?
Depends on what you want to do with that "tile engine", but that should work in most cases.
SuperSmashcz
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 3
Joined: Sun Apr 26, 2009 12:44 pm

Re: Just a quick question

Post by SuperSmashcz »

When i used to work in XNA (OMG!) I had done the exact same thing. I created a layer class which held data for a specific layer, then a tile class which held multiple layers so i could put on top of another. Then a map class which had an array of tiles representing the map. It was just a nice way to break up the parts and organize it. They way your doing it should be fine. Just try to be cautious of performance if you have too much stuff going on at once.
deathsangel
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Apr 18, 2009 8:17 pm

Re: Just a quick question

Post by deathsangel »

I used to work with xna too. I havnt really noticed such a speed difference between xna and sdl
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine :)
Post Reply