Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Help with tile-based levels

Author
Message
gameangel147
11
Years of Service
User Offline
Joined: 2nd Dec 2012
Location:
Posted: 26th Sep 2013 06:19
I am working on a top-down 2D tower defense game and I am trying to figure out how to work tile-based levels. I seem to have figured it out but not really sure where to go from here and I have some questions. Also I have included the two tiles I am using.

-Unless I use the \"color backdrop\" command, regard less of number used, the background with flash blue, which hasn\'t happened to me in other programs where I just used the \"backdrop off\" command.

-I cannot create the sprites inside a repeat loop like I have had to before, it has to be done outside and I\'m not sure why.



Any information as to how my code is or how I can get tile-based levels and collision to work would be appreciated.

On a side note, I have a game I have mostly finished, but I would like to have my code looked at to get advice on how I can make it better and maybe get some bugs fixed. Where on the forums would be the best place to post it. And again thanks for the help!

Attachments

Login to view attachments
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 26th Sep 2013 08:11 Edited at: 26th Sep 2013 08:18
The problem with DBPro, is that some functions do more than what they say on the tin. The functions for sprite and 3D object, creation will also turn the backdrop on. The backdrop color by default is blue. If you want to turn the backdrop off, do it after the creation functions. Also DBPro does some thing differently between do/loop and repeat/until. This may be the issue, but your seem to have that worked out. When the backdrop is on, the sync function will clear the backbuffer for you. So the CLS function is not necessary. Not to nitpick, but DATA statements are customarily at the end of the source.

For tile based collision, a lot of information can be found searching the forum on that. This board is a good place to post code for assistance. There are a lot of good folks here, that will be happy to help.
gameangel147
11
Years of Service
User Offline
Joined: 2nd Dec 2012
Location:
Posted: 27th Sep 2013 01:46
Thanks for the help, though I realized that I forgot to turn the sync on and set the sync rate. Derp. And I normally had trouble due to leaving out a CLS or a SYNC, so I tend to put them both there to be safe. Also thanks for the tip on the data statements, and I actually want to try putting them in a text file, might be easier to keep organized. Again thanks for the help.
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 27th Sep 2013 07:30 Edited at: 27th Sep 2013 08:02
If you mean reading the data from a text file? It would be faster to write a program to save the array to a binary file. Keep this file in your project folder, you may want to edit it latter. Then just load the array into the program.

Save array example:


Load array example:

Login to post a reply

Server time is: 2024-11-23 14:47:21
Your offset time is: 2024-11-23 14:47:21