Scrolling?

Moderator: tr1p1ea

Post Reply
User avatar
ProphetsDementia
Regular Member
Posts: 81
Joined: Wed 06 Dec, 2006 2:20 am
Location: Tokyo, Kanto, Japan

Scrolling?

Post by ProphetsDementia »

I have a question about xLib. I understand how to scroll the screen but, it seems to have trouble scrolling farther than 7 x 11. I am trying to make a platformer but I can't go to other parts of the map and I can't get CreateTileMap to draw one part of a larger matrix.

Any suggestions or advice?

Thanks,
ProphetsDementia

(P.S. My new project is called Kaze no Tsuraga (pronounced Ka-say NO Sue-ra-ga) AKA Tsuraga of the Wind.)
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

Make sure you have a variable that is used for the changing of the screen, where you change your X_Offset and/or Y_Offset.

Code: Select all

real(2,Matrice_Name,X_Offset,Y_Offset,MapWidth,MapHeight,ScreenStartX,
ScreenEndX,ScreenStartY,ScreenEndY,mPIC_Num,Tile_Method,Tile_Size,Map_UpdateLCD
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

If you want smooth scrolling you'll have some more work to do.. Do you need smooth scrolling? I'm not 100% sure how it works though..

anyway, you should have checks to see that you don't start at a negative place and that you won't 'go over the edge' at the right and bottom sides.
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

Smooth scrolling is not something I would incorporate into basic.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

neither would I, but it is ProphetsDementia's project
User avatar
dysfunction
Calc Master
Posts: 1454
Joined: Wed 22 Dec, 2004 3:07 am
Location: Through the Aura

Post by dysfunction »

Smoothscrolling can be done decently with xlib, actually. Just buffer your tilemap into pics first. The main problem is that displaying and scrolling very large (i.e., screen-sized) sprites is somewhat buggy at the moment.

Yes, your friendly neighborhood dysfunction is back. Sort of.
Image


"You're very clever, young man, but it's turtles all the way down!"
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

dysfunction wrote:Yes, your friendly neighborhood dysfunction is back. Sort of.
Good to see you are back, and you are right..Check out the SS from this sub forum, and you will find a pic of tr1p1ea showing a girl from FF which is smooth scrolling I believe (if it is not you could do 2 pixel scrolling).
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4135
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Image

Theres the screenie :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
dysfunction
Calc Master
Posts: 1454
Joined: Wed 22 Dec, 2004 3:07 am
Location: Through the Aura

Post by dysfunction »

Actually I never got around to asking you, tr1p, but one thing has been bugging me. When scrolling sprites with overwrite logic, why is it necessary to clear the screen each frame before drawing the sprites to prevent weird lines from showing up?

Also, I need to get around to giving you code to demonstrate the whole stuff-only-appearing-off-the-edge-of-the-screen-when-aligned-when-scrolling-horizontally -with-ld-logic thing. Let me upgrade to the latest version and make sure it still happens...

Also while I'm sort of on the subject, I've got one more feature request (poor tr1p). With some sprite libraries (including, iirc, the original xlib), when you moved a sprite partially off the screen it would wrap back around on the other side. Would it be possible to have that as an option? It would be very useful for repetitive scrolling backgrounds. That way you would only have to be displaying a single 96x64 sprite, rather than 2 (if only scrolling vertically or horizontally) or 4 (if scrolling BOTH vertically and horizontally).
Image


"You're very clever, young man, but it's turtles all the way down!"
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4135
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

The 'wrapping horizontally' wasnt wrapping at all, it was due to the fact that the sprite routine wasnt a clipped one. If you look carefully you will notice that if you go off the right edge, it will appear 1-pexil further down on the left when it wraps. This is actually a problem and the sole reason why we have 'clipped' sprite routines since if you were to move off the bottom-right edge, you would overwrite memory that you shouldnt when it wraps down.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
dysfunction
Calc Master
Posts: 1454
Joined: Wed 22 Dec, 2004 3:07 am
Location: Through the Aura

Post by dysfunction »

Ah, I see. And actually, strike my last about scrolling screen-sized sprites being buggy. The issue doesn't seem to appear anymore.
Image


"You're very clever, young man, but it's turtles all the way down!"
User avatar
DJ_O
Calc King
Posts: 2315
Joined: Mon 20 Dec, 2004 6:47 pm
Location: Quebec (Canada)
Contact:

Post by DJ_O »

darn I am almost tempted to post this pic on my forum, but I'm sure invisionfree will claim it's porn and delete my board <_<
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

DJ Omnimaga wrote:darn I am almost tempted to post this pic on my forum, but I'm sure invisionfree will claim it's porn and delete my board <_<
Nah, but it would be a nice avatar ;)..
Post Reply