Page 1 of 1

Scrolling object on screen in scroll plan

Posted: Mon Sep 26, 2016 8:10 pm
by matteus
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;
    }
}

Re: Scrolling object on screen in scroll plan

Posted: Mon Sep 26, 2016 8:12 pm
by matteus
Okay this code works now :D but is there a better way to do it?

Re: Scrolling object on screen in scroll plan

Posted: Tue Sep 27, 2016 8:32 am
by Stef
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.

Re: Scrolling object on screen in scroll plan

Posted: Wed Sep 28, 2016 10:07 am
by matteus
I was struggling with whether the measure was in tiles or pixels! :)

Re: Scrolling object on screen in scroll plan

Posted: Wed Sep 28, 2016 12:00 pm
by Stef
So i guess you realized they are in pixels ;)