Here's another LGPL module to let you zoom in and out on a sprite. The RawDraw functions are used to put the sprite on the background with different scaling.
Updated 28/11/05: Moved repeatedly_execute stuff into rep_ex_always, so you can use Wait commands with the zoom stuff.
Updated 4/8/06: Fixed to work with AGS 2.72
// Functions:
//
// Zoom.zoom(int sprite, float speed, float startscale, float endscale, int startx, int starty, int endx, int endy)
//
// Zooms in on sprite from staring scale to ending scale.
// speed is a multiplying factor for the scale at each step
// endx and endy are the top-left coordinates of the area onscreen
// to which the zooming will head towards
// startx and starty are the inital coordinates of the top-left of the sprite
//
// Zoom.zoomdone();
// Returns 0 if currently zooming, 1 if not zooming.
Download here (http://ssh.me.uk/Zoom.zip) (Requires AGS v2.71)
Documentation (http://ssh.me.uk/parsemodzip.php?modfile=Zoom.zip)
Thank you SSH for one more fine module.
Indeed, good work SSH -- your module production rate is pretty impressive :)
Changing the module to use repeatedly_execute_always now allows you to do:
while (Zoom.zoomdone()==0) {
Wait(1);
}
Here is some code I have tested, with rep_ex_always in the module:
// room script file
#sectionstart room_a // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
// script for Room: Player enters room (before fadein)
RawClearScreen(0);
Zoom.zoom(6, 1.015, 1.0, 10.0, 0, 0, 200, 80);
}
#sectionend room_a // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart room_b // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
// script for Room: Player enters room (after fadein)
while (Zoom.zoomdone()==0) {
Wait(1);
}
Display("Tada!");
}
#sectionend room_b // DO NOT EDIT OR REMOVE THIS LINE
Also, I uploaded the new module (see edit in top post)
Speaking as an experienced professional programmer the phrase "I only changed the one thing" never fills me with confidence ;)