RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic  
View previous topic - View next topic  
Author Message
FAss
Pretty, Pretty Fairy Princess


Joined: 23 Nov 2002
Posts: 5
Location: Reign of Chile

PostPosted: Sat Dec 28, 2002 11:44 pm    Post subject: scrolling question.. [quote]

I have designed a tile based engine, when I move the character it moved "from one square to another", when it scroll's it goes also "from one square to another" showing the tiles of the map matrix that are on screen (I did it with 2 whiles to copy the part of the matrix into a buffer bitmap), now this is the problem: I made the character move "continuosly" now like in the real games, it goes pixel by pixel and looks ok, but I don't know how to do a real scrolling with the map, I have problems thinking a way to plot the part of the "map matrix" that you have in screen moving pixel by pixel.. I'm thinking on many special cases to consider (when you are in the borders..) it is hard to think. I have an idea, I don't know if its used in games because it might me too consuming for the memory, it is puting the whole map matrix (it could be a huge map) in a BITMAP, then ploting in screen the part of this huge bitmap where you are, with that I could do it, but I think how much inefficient it is..

please can anyone who has experiencie in this issue help me

by the way, the "matrix map" is a 2x2 array holding numbers, and every number refers to a tile.. that..
_________________
FAss
Back to top  
Tenshi
Everyone's Peachy Lil' Bitch


Joined: 31 May 2002
Posts: 386
Location: Newport News

PostPosted: Sun Dec 29, 2002 4:02 am    Post subject: [quote]

- Well... I am not sure I quite understand you... but:

Suppose you have an OffsetX and OffsetY for a sprite on the screen in a tile-based Map engine.
You also have several known variables:
BeginX - The top corner tile's X value in correspondence to a large matrix of map data.
BeginY - ... Look above.
Map Tile Width
Map Tile Height

AbsolutePixelX = MapTileWidth * BeginX + ScreenOffsetX
AbsolutePixelY = MapTileWidth * BeginY + ScreenOffsetY

That's for a pixel-based Tile-by-tile engine. For mine, I also add an offsetX and offsetY on the actual tile. So the sprite can move around on the tile, and once it reaches less-than-zero or greater than the width/height of the tile, then they move to the next tile, with a slightly less-than-max offset. I usually use a Modulus to determine whether or not it's off the tile. For example, with a width/height of 20, such as with my tiles, and a movement of 4 pixels per "movement": 4, 8, 12, 16. Mod 20. 0 Mod 20 = 0 and 20 mod 20 = 0. So basically, when the character reaches a modulus of 20, they are on another tile.

- I hope that helps somewhat. I can elaborate further at another time.
_________________
- Jaeda
Back to top  
entivore
Bjørn's Arctic Bitch of the Frozen North


Joined: 20 Jul 2002
Posts: 86
Location: michigan, usa

PostPosted: Sun Dec 29, 2002 7:37 am    Post subject: [quote]

Yeah, what tenshi said. Plus you'll want to just use some form of tile clipping, rather than combining tiles into one big bitmap. The tile system was created to save memory, because one big bitmap is too huge.

What I do is just have a PlayerX, PlayerY, and then do a /24 to get the tile, and %24 to get the offset. If the offset is zero, I just do a straight blit. If the offet is anything else, I turn the clipper on, do a blit on the edges, then turn the clipper off and fill in the remaining tiles.
_________________
*Only in darkness can one truely shine*
Back to top  
Ninkazu
Demon Hunter


Joined: 08 Aug 2002
Posts: 945
Location: Location:

PostPosted: Sun Dec 29, 2002 7:16 pm    Post subject: [quote]

Um... Baldurs Gate uses huge bitmaps for its maps. Not entire bitmaps for the map, but very big portions are in one bitmap. Just saying.... it is done.
Back to top  
Fooolking
Xmark's Caged Bitch


Joined: 16 Dec 2002
Posts: 79
Location: Toronto, Ontario. Canada

PostPosted: Sun Dec 29, 2002 7:51 pm    Post subject: .............. [quote]

Are you guys............speaking.......words?

*hides from the programmers*

Damn you, stop confusing my feeble mind!
_________________
Never milk cows that have uni-brows.
Back to top  
Post new topic Reply to topic Page 1 of 1 All times are GMT
 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum