|  | 
 
 Well that should set up the basic screen res and include the scancodes file which will be made in a sec. That should set up our arrays(the mapData one is redundent its only there incase i make a second tut) This should set up all the global variables, most are self-explanitory. It also loads the images and masks them(makes them transparent)Which if you don't download the source,you should replace. This is all the main junk which ill explain in a minute. all though this may look daugnuting its all very simple. first it initiates the main loop, then it calls all the control functions. the functions are quite self-explanitory but ill go throught them all the same The control function just checks for key presses and canges the map array accordingly. The update function draw the map array to the screen, or in case its in mode2 it draws the collision boxs. The sky function initiates and draws the scrolling background. The info function just writes some instructions onto the screen. The save and load functions are self explanitory. The grid function draws a basic grid overlay onto the screen. The fill function, which is called at the start just fills the map array with a basic tile, in this case its a grass tile. This editor basically has 2 modes one which allows the changing of tiles and the other allowing collision boxes to be placed, There are to types of collision in this editor, one is normal and the other can be customised, in the example game its used to damage the player. Look at the example game to get ideas on how to use it.(a level needs to be made for the example to run) The next stop is the scancodes file, so save the editor and start a blankfile called 'scancodes.bb'. Just fill in this and save the fill its just the scancodes for all the keys on the keyboard, so it dosen't need any explaining. Just run the editor and it should work (providing you've downloaded the tiles or made your own, in which case you need to change the tiles loading command) Unfortunatly im going to have to continue this tutorial in a day or so.. but your editor should work now! The HUD and Example game are included on the source code download. Sorry for the messy code! Final Product To load the level into a game just use these functions; Ive left out multiple file saving in the editor, so that you can do something yourself, its just a matter of using the input command ; ) THANKS! Please send any comments to tpl@aol.com For a printable copy of this article, please click HERE. 
 This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.   |