Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!hoptoad!autodesk!apple!motcsd!lance From: lance@motcsd.csd.mot.com (lance.norskog) Newsgroups: alt.sources.wanted Subject: Re: Programming a Mah-Jongg type game Keywords: ideas or sources wanted Message-ID: <3981@motcsd.csd.mot.com> Date: 20 May 91 00:54:38 GMT References: <556@ceco.ceco.com> Organization: Motorola CSD, Cupertino CA Lines: 20 sung@ceco.ceco.com (Sung Han) writes: > Now for my question - I know that everyone and his cousin has written a >Mah-jongg/Taipei type of tile-removal game at one time, and I'm trying to >do the same (a rite of passage, if you will). However, I'm stuck on the >problem of figuring out how to redraw tiles whenever a tile is deleted. The >problem is that since the tiles are stacked several levels high, and seen from >an angle, they can overlap each other in weird ways - and I'm hard pressed to >figure out which tiles to redraw and in what manner. Well, you can paint all tiles from bottom to top, or "back to front" as its called in computer graphics. Starting from the top of the stack, you decide the list of tiles you want to paint, i.e. if 4 overshadows 3, remove three from the list. Now, paint the bottom up to the top. To cut down on screen I/O, you can do a z-buffer algorithm where you build a "virtual screen" where each dot is a tile number or background. You then just paint the screen, reading each dot code number and looking up the appropriate pixel from your background or tile bitmaps. Lance