Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: mperdue@iquest.net (Mario Perdue) Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: multiple sprites -- problem, need help Date: Sat, 26 Jul 1997 19:36:46 GMT Organization: SCEA Net Yaroze News Lines: 44 Message-ID: <33da4c14.471308@205.149.189.29> References: <33DA2CA6.4A7F@leland.stanford.edu> NNTP-Posting-Host: firewall.hrtc.net X-Newsreader: Forte Free Agent 1.1/32.230 On Sat, 26 Jul 1997 09:58:14 -0700, Kevin wrote: >I can't seem to get multiple sprites to display. With the code >below, all the sprites come out looking like ship2.img. Am I >missing something in the definition? It isn't well-written, >but I am just trying to get something working so I can make >some basic functions I can use all the time. > >[snip] > >sprtShip[0, 1, 2, 3] is supposed to show up depending on which >direction the ship is heading. But only sprtShip[0] shows up, >no matter which direction the control is pressed. Also the four >ships at the top center of the screen all look the same, when they >should be different. I checked the .img files to make sure they >are different and they are, and they defined as > >SHIP2 (x, y): 320, 0 >SHIP3 (x, y): 330, 0 >SHIP4 (x, y): 340, 0 >SHIP5 (x, y): 350, 0 > >in the .img file. > Dan, The frame buffer is a 1024x512 pixel rectangle in memory. There are 32 (0-31) texture pages in the frame buffer. Each texture page must fall on a 64 pixel boundary in the x-axis and a 256 pixel boundary in the y-axis. With the x,y pairs you have specified, all of your sprites are in the same texture page. It's OK to do this, but you'll have to set the pattern offset for each of the sprites. SHIP2 should have a pattern offset (u,v) of 0,0; SHIP3's offset is 10,0; SHIP4 is 20,0 and SHIP5 is 30,0. If you don't what to use the pattern offsets, you could relocate your sprites so they are in different texture pages. Just space them 64 pixels apart in the x and 256 pixels apart in the y; 320,0 384,0 etc. Mario