Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: jamin1@psu.edu (Jamin Frederick) Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Beginner in atmosphere! Date: Wed, 09 Jul 1997 19:03:21 GMT Organization: SCEA Net Yaroze News Lines: 54 Message-ID: <33c3d911.5091686@news.scea.sony.com> References: <33C32D5F.7DB3@earthlink.net> NNTP-Posting-Host: nb5ppp166.cac.psu.edu X-Newsreader: Forte Free Agent 1.11/32.235 On Tue, 08 Jul 1997 23:19:11 -0700, "Linda J. Hodge" wrote: >Can anybody explain how hidden page scrolling works for the yaroze? You can do it using the GsBG structure that Sony provides, but that's sort of limited because you have to use 16x16 pixel tiles. Anyway, you just load up some TIM images, say 5 different tiles you want to use for your background and then you'd make 5 GsCELL structs that reference these images -- cells are the elements that make up the GsMAP struct. In fact, in the GsMAP struct there's a pointer to an array of GsCELL structs, in this case its size would be 5, which are all the different image tiles your world will have. It also has a pointer to an (m x n) array of ushorts, called 'index', where m is the width in cells of your world, and n is the height in cells, which are just indices into the corresponding GsCELL array. So this is the map that corresponds to your game world. When you do GsSortFixBg16(), the psx takes care of where the screen is positioned in the world by means of the scrollx and scrolly elements of the GsBG struct. if you specify (0,0), you'll get the upper-left corner of your world. If you specify (2, 3), the screen will be 2 pixels right and 3 pixels down. If you specify (-2, -4), you'll be 2 pixels left and 4 pixels up from the bottom right of your game world (it wraps). Take a look at my tiles1.zip and tiles2.zip, I use this method to scroll. Alternatively, you can use your own sprites as game tiles and forget about the BG tiling thing. What you do is give your sprites a world position, and the screen a world position. The sprites will be positioned on the screen according to the translation SpriteScreenPosition = SpriteWorldPosition - ScreenWorldPosition so if your screen is at (0,0), the sprite's screen position will just be its world position. However, if your user decides to scroll the screen down and right, then the ScreenWorldPosition will increase both x and y directions, and consequently, the SpriteScreenPosition will decrease. So it looks like your sprite is moving up and left, get it? I've done this too, with logos.zip. The only thing that you should worry about after this, though, is when to start "clipping" your sprites, or not stick them in the Ot to be sorted, since they are off-screen and are not seen anyway. If there's say 100 sprites you're sorting, but only 2 on the screen, then it's sort of a waste to make the hardware clip these with the OT, but who knows, maybe the hardware clips the extra sprites just as fast as I would *not sort* them into the OT anyway. What does everyone else think? Jamin http://www.cse.psu.edu/~frederic/home.htm