Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Scrolling Issues

Author
Message
CrayZemon
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: United States
Posted: 3rd Jul 2003 05:52
Well, my first scrolling implementation had marginal success. However, the sprites would get all mixed up bewteen the first and second layers, so I decided to restart the project. The second implementation is rather sketchy and reaching horrible barriers. Every time I load the tile_map(x,y) I always have to find the beginning of it. Part of the problem stemmed from a home-brew clipping algorythm I attempted to perform that would only display the tiles that can be seen within camera_x, and camera_y variables. Can someone show me an effecient way of loading and scrolling the tiles needed for a vertical-type action game, please? The clipping function also seemed to slow things down instead of speed 'em up.
"I need gopher-chucks!!"
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Jul 2003 23:38 Edited at: 3rd Jul 2003 23:39
Aha, ready made tiling snippet to the rescue



It doesn't have very good graphics, but you can see it scrolling in eight directions by using the arrow keys. Oh, and the sprite in the centre was just to show how to scroll but keep your character at the centre.

The clipping routine isn't great either, but I didn't have the time to do it properly ... it does run fast enough without it, but with a larger tiling area it would be slow.
CrayZemon
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: United States
Posted: 5th Jul 2003 03:57
Sorry IanM, I don't have DBpro. Therefore, I've got a truckload of errors and syntax stuff that's getting in my way here. The code looks good though. Wish I had DBpro.

"I need gopher-chucks!!"
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2003 15:09
Ok, just for you ...



It's even uglier than the DBPro version, but it works with Classic
CrayZemon
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: United States
Posted: 5th Jul 2003 16:17
Whoa, cool! Thanks a bunch IanM.

"I need gopher-chucks!!"
Dreadlox
20
Years of Service
User Offline
Joined: 31st May 2003
Location:
Posted: 6th Jul 2003 19:42
Sorry to be irritating like this, but when I ran this code I had to delete the "flush video memory" command for it to work.

CrayZemon
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: United States
Posted: 7th Jul 2003 06:28
I wish I knew, Dreadlox. My PC and DB version don't have a problem with it. Could be a bug or something else.

Ianm, I was wondering some about the clipping details. Is it possible to clip images fully so that only whats inside the 640/480 or whatever resolution's "rectangle" are drawn. Do we have that kind of power over image functions?

"I need gopher-chucks!!"
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jul 2003 20:34
Afraid not. When you're drawing images, it's all or nothing.

If you had a reduced area that you needed to draw to, you could instead draw to a secondary bitmap that was at the reduced size, then use COPY BITMAP to draw it to bitmap 0 (the main bitmap).

Login to post a reply

Server time is: 2024-04-24 08:02:14
Your offset time is: 2024-04-24 08:02:14