Path: chuka.playstation.co.uk!news From: "Andrew Partington" Newsgroups: scee.yaroze.freetalk.english Subject: Re: walking up tiles Date: Fri, 31 May 2002 00:31:41 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 80 Message-ID: References: NNTP-Posting-Host: public2-ward1-6-cust190.manc.broadband.ntl.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Hi Nigel I can tell you how i'm doing it in Gravity Girl if you're interested (really must get back to it someday, its been about a month since I last looked at it...). I'm personally not doing any lookahead, just attempting to use the same map for everything, but it may solve a couple of glitches i've been having, so its a good idea. The way I move the character around the map at the moment (more accurately, I move the map around the character, but the same principles should apply) is: spriteObject->accelX+=(spriteObject->accel*SIN[spriteObject->angle>>12]>>12) ; spriteObject->accelY+=(spriteObject->accel*COS[spriteObject->angle>>12]>>12) ; This assumes that 0 degrees is pointing straight up along the Y axis of the screen. All accelX and accelY values will have to be divided by 4096 (i.e. >> 12) if you want to convert them back to their integer-only representation. The sine/cosine tables I am using were created using SCBUILD v1.1 by James Shaughnessy. OK, in your collision detection routine you would detect the block that your character is standing on, and then change the angle accordingly: (time for another cut-n-paste job from my code, sorry if the ascii art doesn't show properly, it's meant to be 2 right angled triangles and a cube. The arrows show the approach from the left or right) /* Change the angle to move GG along depending on what type of block we are looking at: /| <- 225 deg. |\ -> 145 deg. /__| -> 45 deg. |__\ <- 315 deg. __ | | <- 270 deg. |__| -> 90 deg. */ You get the idea. This method will support any angled block you care to support, only downside is the multiply needed if you want pure optimisation, so maybe some sort of lookup table may be the way to go. Hope this helps Andy "Nigel Critten" wrote in message news:aconi3$et15@www.netyaroze-europe.com... > Hi, > > Quick question, I've just started a new tile based game, scolling maps and > all that, all the ones I''ve done in the past have always been blocks so > I've never had to worry about running up hills sliding down them etc. the > way I've seen discused in the past is to have a second map with black and > white versions of the tiles, white being solid, so I look ahead to see what > is coming up if the pixel is white I would need to look up a pixel to see if > the next one is white, is there an easier way of doing it, can anyone point > me in the direction of an online tutorial or article on this? > > Cheers > Nigel > >