Path: chuka.playstation.co.uk!news From: "Mario Wynands" Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: I need help with sprites ,Please Someone Help ! Date: Sun, 22 Aug 1999 11:44:22 +1200 Organization: PlayStation Net Yaroze (SCEE) Lines: 58 Message-ID: <7pndlh$8mo7@chuka.playstation.co.uk> References: <7pml93$al81@scea> NNTP-Posting-Host: p45-max8.wlg.ihug.co.nz X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Terry Arnold wrote in message news:7pml93$al81@scea... > I need someone to show me how to take a 256*100 sprite and only allow > 64*100 to be shown on the screen and then be able to scroll around that > 256*100 sprite seeing only at 64*100 at a time . > Does anyone know how to do this ? Hi Terry, Sounds like you want to do something like a scrollable map. The attributes of the GsSPRITE structure that you have to manipulate to achieve this are w, h The width and height of the sprite u, v The sprite pattern offset within the texture page If you only want 64*100 of the 256*100 texture image to be shown then you would set up w and h somewhere in your initialisation code something like sprite.w = 64; sprite.h = 100; (as well as setting up the other attributes like x, y, and all the texture stuff). The u and v attributes will determine which part of the texture is displayed by the sprite on the screen, and you will have to change those to display the relevant section of the texture image within your game loop. Assuming your texture image is aligned to the top left of a texture page then your u attribute will range in value between 0 and 191 (255 minus 64, or roughly the width of the texture minus the width of your sprite) whereas your v attribute will stay constant at 0 which is the top of your texture (meaning you can also set up v in your initialisation code). So, every time you go to sort your sprite into the ordering table you'll need to set the u attribute to the appropriate value. You'll have a better idea of how to do this than me, but assuming it is a map (or something similar) that you are doing then all you need is something that takes the player world coordinates (or whatever) and turn it into a range between 0 and 191. Maybe something like sprite.u = min( 191, player_x_position * 255 / width_of_level ); Note, if your texture image is not aligned to the top left corner of a texture page then you also have to take those offsets into account. Hope this both makes sense and helps. Regards Mario SIDHE INTERACTIVE mario@sidhe.co.nz http://www.sidhe.co.nz