reverse room scaling (SOLVED)

Started by He-Man, Sun 19/06/2005 16:20:10

Previous topic - Next topic

He-Man

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?

Rui 'Trovatore' Pires

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.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Snarky

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.

Rui 'Trovatore' Pires

Great idea. Probably makes for pretty smooth scaling, too.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

Try this:

Code: ags

// 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);
  }

  //...
}

He-Man

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

SMF spam blocked by CleanTalk