This site requires JavaScript, please enable it in your browser!
Greenfoot back
Paciman
Paciman wrote ...

2019/12/12

Trouble with second character and Background

1
2
danpost danpost

2019/12/13

#
Change this:
{
    int dsx = leader.getX()-WIDE/2;
    int dsy = 270;
    scroller.scroll(dsx, dsy);
}}
to
    int dsx = leader.getX()-WIDE/2;
    scroller.scroll(dsx, 0);
}
Paciman Paciman

2019/12/13

#
danpost wrote...
Change this:
{
    int dsx = leader.getX()-WIDE/2;
    int dsy = 270;
    scroller.scroll(dsx, dsy);
}}
to
    int dsx = leader.getX()-WIDE/2;
    scroller.scroll(dsx, 0);

It still doesn't follow Mega2 when Megaman dies
}
danpost danpost

2019/12/13

#
Paciman wrote...
It still doesn't follow Mega2 when Megaman dies
Okay ... replace:
int dsx = leader.getX()-WIDE/2;
scroller.scroll(dsx, 0);
with:
int dsx = leader.getX()-WIDE/2;
int dsy = leader.getY()-HIGH/2;
scroller.scroll(dsx, dsy);
(not sure why you changed it to begin with)
Paciman Paciman

2019/12/13

#
danpost wrote...
Paciman wrote...
I wrote it like this, what should i correct ? << Code Omitted >>
Remove the last if structure around the scrolling code.
Okay i found my mistake Thanks for giving me so much of your time
You need to login to post a reply.
1
2