Hi
I'm having a problem with the room scaling.
I want to reverse the room scaling so the character becomes smaller when he walk down.
I've tried to use continouus scaling (AGS automaticly reverses my settings) and SetAreaScaling (AGS give my an error when loading the game).
Is there anyway to do this?
Hmm, can't you just set each area to have it's own scaling in the editor? Not as smooth as continuos, but it'll work.
Or you could do it in code. Just get the y-coordinate of the character, calculate the right scale factor and set the region scaling to that. I seem to remember some one making a game where the character was walking on the walls, and used a technique similar to this to achieve it.
Great idea. Probably makes for pretty smooth scaling, too.
Try this:
// room script
#define AREA_NUM 2
#define AREA_SCALING_TOP 100
#define AREA_SCALING_BOTTOM 10
#define AREA_EDGE_TOP 100
#define AREA_EDGE_BOTTOM 190
function repeatedly_execute_always() {
//...
if (GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()) == AREA_NUM) {
int scaling = AREA_SCALING_BOTTOM + (((AREA_EDGE_BOTTOM - player.y) * (AREA_SCALING_TOP - AREA_SCALING_BOTTOM)) / (AREA_EDGE_BOTTOM - AREA_EDGE_TOP));
SetAreaScaling(AREA_NUM, scaling, scaling);
}
//...
}
Thanks a lot everyone.
Especially Strazer!
Things seem to work as they should now. I'll just play a little with your numbers until everything looks as it should.
Cheers