Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: don_tomaso on Thu 27/10/2005 01:10:22

Title: reversing continuous scaling?
Post by: don_tomaso on Thu 27/10/2005 01:10:22
is there a way to reversing continuous scaling, so that instead of making sprites go from small to big when moving down the screen, they go from big to small?

when I try to enter the numbers in the continuous scaling box, they just reset themself if I enter a reversed value..
Title: Re: reversing continuous scaling?
Post by: strazer on Thu 27/10/2005 01:29:54
Not natively, so you have to script it. Try this:

Make a view with vertically flipped frames of the player character's view and enter it in the walkable area's "Change player view while on this area", then


// room script

#define WALKAREA_ID 2 // number of the walkable area
#define WALKAREA_TOP_EDGE 202 // adjust these to the dimensions of your walkable area
#define WALKAREA_BOTTOM_EDGE 329
#define WALKAREA_SCALING_TOP 100
#define WALKAREA_SCALING_BOTTOM 50

function repeatedly_execute_always() {
  //...

  if (GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()) == WALKAREA_ID) {

    int scaling = WALKAREA_SCALING_BOTTOM + (((WALKAREA_BOTTOM_EDGE - player.y) * (WALKAREA_SCALING_TOP - WALKAREA_SCALING_BOTTOM)) / (WALKAREA_BOTTOM_EDGE - WALKAREA_TOP_EDGE));

    SetAreaScaling(WALKAREA_ID, scaling, scaling);

    int spriteslot = GetGameParameter(GP_FRAMEIMAGE, player.View, player.Loop, player.Frame);
    player.z = -((GetGameParameter(GP_SPRITEHEIGHT, spriteslot, 0, 0) * scaling) / 100);

  }
  else player.z = 0;

  //...
}


This code only works on the player character.
Title: Re: reversing continuous scaling?
Post by: Janik on Thu 27/10/2005 03:37:39
Just out of curiosity, how come you need the sprites to be smaller as they go down?
Title: Re: reversing continuous scaling?
Post by: strazer on Thu 27/10/2005 04:14:34
Walking on ceiling perhaps?

I've taken the code from an earlier reply of mine regarding that very problem:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20494
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20553 (the follow-up)
Title: Re: reversing continuous scaling?
Post by: don_tomaso on Thu 27/10/2005 11:26:47
thanks a lot guys..


and its for a sequense with a spaceship, flying from the top of the screen to the middle, moving away from the camera..
Title: Re: reversing continuous scaling?
Post by: Elliott Hird on Thu 27/10/2005 14:18:57
Wouldn't you just do

100 to 45

instead of 45 to 100????
Title: Re: reversing continuous scaling?
Post by: don_tomaso on Thu 27/10/2005 17:42:37
no, the game automaticly resets the numbers from 100-45 to 45-100 if you do it, for some strange reason..
Title: Re: reversing continuous scaling?
Post by: Elliott Hird on Thu 27/10/2005 19:01:57
Strange. Strazer, do one of your tracker additions :D
Title: Re: reversing continuous scaling?
Post by: monkey0506 on Thu 27/10/2005 22:06:05
Quote from: The AGS Bug Tracker* allow continuous scaling in 4 directions (down, up, left, right) to scale
the appropriate way

Would this be it?

http://adventuregamestudio.co.uk/tracker.php?action=detail&id=59

[EDIT:]

BTW Elliott, the mods don't generally take too lightly people just telling them what to do...perhaps asking instead of demanding.  But then it's not my place to reprimand you on your conduct.
Title: Re: reversing continuous scaling?
Post by: Elliott Hird on Fri 28/10/2005 14:17:52
Sorry, it was just a joke tho.
Title: Re: reversing continuous scaling?
Post by: monkey0506 on Sat 29/10/2005 00:19:18
It's all good...but...you like to joke.  A lot. :=
Title: Re: reversing continuous scaling?
Post by: Elliott Hird on Sat 29/10/2005 10:38:51
And you have a problem with that? :D
Title: Re: reversing continuous scaling?
Post by: strazer on Sat 29/10/2005 16:59:38
Quote from: monkey_05_06 on Thu 27/10/2005 22:06:05Would this be it?

http://adventuregamestudio.co.uk/tracker.php?action=detail&id=59

Yes, I really should have included reverse scaling in the entry's title. Nice find.
Title: Re: reversing continuous scaling?
Post by: monkey0506 on Sat 29/10/2005 23:27:49
Well, IMO it would make more sense as a separate (although connected) entry.
Title: Re: reversing continuous scaling?
Post by: Wretched on Sun 30/10/2005 18:57:06
Just a thought, but you might be able to get around the scripting by using FlipScreen() ?
Title: Re: reversing continuous scaling?
Post by: Elliott Hird on Mon 31/10/2005 10:51:35
That's a buggy feature, and it'd be really hard to make it work right.
Title: Re: reversing continuous scaling?
Post by: Wretched on Mon 31/10/2005 11:59:04
Yes, I only suggested it as an alternative method, I didn't mean to recommend it.
Anyway after a bit more thinking, just make the spaceship sprite with a lot of empty space below the ship and have it walk normally into the distance, this should give the effect of it descending provided there is enough space to make it appear above the screen, so to speak.
Better would be to use a character with the normal spaceship graphic z value large enough to make it appear above the horizon.

[EDIT] Oh oh z values doesn't get scaled, anyway this works, using character with space below picture,
Download (http://www.alpha72.com/CRS/CRS.rar)
Title: Re: reversing continuous scaling?
Post by: strazer on Mon 31/10/2005 12:38:05
Ingenious! Perfect, simple solution for this particular problem.
Title: Re: reversing continuous scaling?
Post by: don_tomaso on Mon 31/10/2005 13:52:30
yeah that was a good solution, but I dont think itll work for me, my spaceship comes in from NE corner of the screen, then flies away out of the screen in the middleleft, and that method doesnt work here since the ship is moving downwards.. but still, it is a good method and Ill probably use it in the future, thanx :)
Title: Re: reversing continuous scaling?
Post by: Wretched on Mon 31/10/2005 13:55:46
Don't see your problem, the ship can move anywhere, just use the walk button after cutscene.