Post

 Resources 

Console


Re: Scrolling games Peter (2 replies, 0 views) (2001-Mar-4)
-
I'm pretty tired so forgive me if this doesn't make too much sense ;) The way I would do it would be by using a type for your enemies, like: type Soldier coorx as integer coory as integer end type Then the x and y variables for your enemies could range from 0 to whatever the size of your playing field is, the coorx value could be 3200, etc. So if you're trying to do pathfinding you can use any points and it will work. To determine when to draw them, you would so something like this: ddsback.bltfast coorx-maprect.lect,coory-maprect.top ... etc. Basically what happens there is maprect.top and maprect.left are the top left coordinates of your viewpoint. If you scroll they would increase or decrease. So what happens is, the enemies are only drawn if they are currently in your viewpoint. Now, this wont work perfectly because you would have to use a clipper to clip any sprites that are partially offscreen, because otherwise they would simply disappear as soon as they are even 1 pixel offscreen. You could also optimize it so that you wouldnt even call the blt routine if the sprite was out of the current viewpoint. That would probably save some cycles :) The way I would do this would be to have a seperate subroutine to do blitting that would automatically handle clipping and ignoring certain requests (ie: drawing sprites that are out of the viewpoint). If you want an example, look up BiohazrdDD, which is a graphics library for DirectDraw 7. You can get it from Voodoo VB (www.redrival.com/voodoovb/) from the source code page. Look up DDBltFast and DDBltFastAnim, the latter also handles animation automatically :) hth and I also hope it made sense =) Peter


-
Up One Level | Back to Forum

Re: Peter Pan Sites Soop (0 replies) (2001-Mar-4)
Re: Scrolling games tatsuo (0 replies) (2001-Mar-4)

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 25 visitors within the last 20 minutes
RSS News Feed