Offset function for sprites?

Started by Knox, Wed 13/05/2009 18:15:39

Previous topic - Next topic

Knox

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.



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!

--All that is necessary for evil to triumph is for good men to do nothing.

Sephiroth

#1
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:

Code: ags

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:

Code: ags

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

Knox

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)?
--All that is necessary for evil to triumph is for good men to do nothing.

Trent R

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
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Knox

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.

--All that is necessary for evil to triumph is for good men to do nothing.

Wonkyth

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.
"But with a ninja on your face, you live longer!"

GarageGothic

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

SMF spam blocked by CleanTalk