Scrolling object on screen in scroll plan

SGDK only sub forum

Moderator: Stef

Post Reply
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Scrolling object on screen in scroll plan

Post by matteus » Mon Sep 26, 2016 8:10 pm

Right ok so I can get a block of tiles to scroll off screen but not on! What am I missing? :) Could someone show me an example?

Code: Select all

void processStartScreen() {
    switch(GameVariables.StartScreenStage) {
    case 0:
        SYS_disableInts();
        VDP_drawText("Press Start", 1, 0);
        SYS_enableInts();
        SYS_disableInts();
        VDP_drawImageEx(PLAN_B, &title_layout, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 153, 26, TRUE, TRUE);
        nextvpos = 0;
        GameVariables.StartScreenStage = 1;
        SYS_enableInts();
    break;
    case 1:
        nextvpos++;
        SYS_disableInts();
        VDP_setVerticalScroll(PLAN_B, nextvpos);
        SYS_enableInts();
    break;
    }
}

matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Re: Scrolling object on screen in scroll plan

Post by matteus » Mon Sep 26, 2016 8:12 pm

Okay this code works now :D but is there a better way to do it?

Stef
Very interested
Posts: 2976
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Scrolling object on screen in scroll plan

Post by Stef » Tue Sep 27, 2016 8:32 am

I don't really understand what you mean by " get a block of tiles to scroll off screen but not on!" ?
VDP_setVerticalScroll(..) or VDP_setHorizontalScroll(..) are the methods to use for hardware scrolling, you can use positives or negatives values depending how you want to scroll you plan. If you scroll all over the plan size then you might refresh part of your plan which is currently off screen.

matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Re: Scrolling object on screen in scroll plan

Post by matteus » Wed Sep 28, 2016 10:07 am

I was struggling with whether the measure was in tiles or pixels! :)

Stef
Very interested
Posts: 2976
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Scrolling object on screen in scroll plan

Post by Stef » Wed Sep 28, 2016 12:00 pm

So i guess you realized they are in pixels ;)

Post Reply