reversing continuous scaling?

Started by don_tomaso, Thu 27/10/2005 01:10:22

Previous topic - Next topic

don_tomaso

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..

strazer

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

Code: ags

// 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.

Janik

Just out of curiosity, how come you need the sprites to be smaller as they go down?
Play pen and paper D&D? Then try DM Genie - software for Dungeons and Dragons!

strazer

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)

don_tomaso

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..

Elliott Hird

Wouldn't you just do

100 to 45

instead of 45 to 100????

don_tomaso

no, the game automaticly resets the numbers from 100-45 to 45-100 if you do it, for some strange reason..

Elliott Hird

Strange. Strazer, do one of your tracker additions :D

monkey0506

#8
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.

Elliott Hird


monkey0506

It's all good...but...you like to joke.  A lot. :=

Elliott Hird

And you have a problem with that? :D

strazer


monkey0506

Well, IMO it would make more sense as a separate (although connected) entry.

Wretched

Just a thought, but you might be able to get around the scripting by using FlipScreen() ?

Elliott Hird

That's a buggy feature, and it'd be really hard to make it work right.

Wretched

#16
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

strazer

Ingenious! Perfect, simple solution for this particular problem.

don_tomaso

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 :)

Wretched

Don't see your problem, the ship can move anywhere, just use the walk button after cutscene.

SMF spam blocked by CleanTalk