Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Wed 13/05/2009 18:15:39

Title: Offset function for sprites?
Post by: Knox on Wed 13/05/2009 18:15:39
I was wondering if there is an "offset" function for placing sprites.

As an example, here is what I would want to do: (Temporary Rip from PQ3, Sonny Bonds)

I got the blinking view to work, but right now I have to use a blinking Sonny portrait with the animated part (mouth) transparent (pink color)...this is a waste of memory...I would much prefer using only the closed eyes as a sprite instead...and indicate with numerical values where I want this sprite to superimpose onto the underlying layers of Sonny's animated talk view.

Does this make any sense?

Here are 2 pics:
1st pic to show what I have now (which is a waste)
2nd pick is what I would rather use as the blinking view that would be super-imposed over the talking animation.

(http://www.2dadventure.com/ags/001xx.gif) (http://www.2dadventure.com/ags/002xx.gif)

If there is this feature, it means I wont have to use same-size sprites for every animation when only small parts of an image are actually moving...therefore saving image space (and time).

Does something like this exist?

Thanks!

Title: Re: Offset function for sprites?
Post by: Sephiroth on Wed 13/05/2009 18:47:24
I guess you could use an invisible object with only the eyes or mouth as graphics, setting its baseline so it overlaps, then assuming the offset of the eyes compared to the sprite's top-left pixel is (20,20) you could draw/animate it over your character sprite:


object.x = Character.X + 20;
object.y = Character.Y + 20;
object.Baseline = screen_height;
object.SetView(eyesonly_view);
object.Visible = true;
object.animate(loop, delay);
Object.Visible = false;


Or maybe use graphical overlays like this:


int i = first_sprite_slot;
while( i <= last_sprite_slot)
{
  Overlay  *Over1 = Overlay.CreateGraphical( Character.X + 20, Character.Y +20, i,  true);
  Wait(1 * 40); //1 sec delay
  Over1.Remove();
  i++;
}


Character.SetIdleView is the olny thing we have, no OnIdle event so you'll have to run the code manually when you need, otherwise use the classic way with the same sprite size. But i don't think it really wastes "that" much memory resources imho, would just make the executable bigger if this is what you meant ;)
Title: Re: Offset function for sprites?
Post by: Knox on Wed 13/05/2009 19:14:45
Ok, thanks, Ill give that a shot!

I guess you're right though, it wont increase memory that much...so perhaps its just simpler to make the whole image...is that what most people do for blinking in the talk view (sierra-style)?
Title: Re: Offset function for sprites?
Post by: Trent R on Wed 13/05/2009 20:49:36
This would probably only be needed if you displayed your speech in a different way than .Say or .Display. But even then, if you had something like Button.Animate you'd most likely be using full sprites.

And, they're not that big.

~Trent
Title: Re: Offset function for sprites?
Post by: Knox on Mon 18/05/2009 05:53:21
Alright, Ill keep it simple and just make the full sprites!

By the way, what is considered a "big" exe file...and what would be "light"?

As in, what number would your game .exe have to be (approx) so that you can start saying "holy crap Im insane..."

I just want to make sure I dont go overboard with graphics + scripts, etc...and end up with an exe way too huge.

Title: Re: Offset function for sprites?
Post by: Wonkyth on Mon 18/05/2009 11:38:19
I'm not sure, but I haven't played an AGS game that was larger than 100MB.
Unless the game is HUGE I wouldn't worry about it.
Title: Re: Offset function for sprites?
Post by: GarageGothic on Mon 18/05/2009 14:22:26
If you enable sprite compression in the General Settings pane of the editor, the blank areas of your sprites will hardly take up any space (especially since they're uniform rectangular areas - to optimize further you could fill all the areas you don't need with the "magic pink" color) so there's absolutely nothing to worry about.