Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Crimson Wizard on Tue 15/09/2009 23:35:37

Title: Drawing part of Dynamic Sprite [SOLVED]
Post by: Crimson Wizard on Tue 15/09/2009 23:35:37
This is rather confusing... can someone tell me is it possible to draw a part of the dynamic sprite to the drawing surface without creating intermediate sprite(s)?

It's like I created a DynamicSprite from a graphic file (DynamicSprite.CreateFromFile), and that file actually contained several images/tiles/whatever; now, if I want to draw only piece of that image on screen, should I really create another one DynamicSprite using DynamicSprite.CreateFromDrawingSurface function and paint it instead?

If there's no other way, the second question is, will creating dynamic sprites on-fly (assuming, for this example, I will have to repaint room quite often) slow game down much?
Title: Re: Drawing part of Dynamic Sprite
Post by: Khris on Wed 16/09/2009 00:11:10
The only other way I know of is copying the sprite and cropping the copy, but this is probably "slower".

Having said that, unless you're performing this operation hundreds of times every loop, no, your game is not going to slow down.

AGS isn't QBasic running on a 286, people.
Title: Re: Drawing part of Dynamic Sprite
Post by: Crimson Wizard on Wed 16/09/2009 00:20:31
Quote from: Khris on Wed 16/09/2009 00:11:10
AGS isn't QBasic running on a 286, people.
Heheh, I have this "that thing may slow application down" paranoia after I was doing outsourcing projects for low-end mobile phones for couple of years.  :-X

Anyway, thanks for the info, Kris.
Title: Re: Drawing part of Dynamic Sprite
Post by: Khris on Wed 16/09/2009 00:56:16
Funny thing is, working on a tile engine right now, I was able to do a quick test.

20x16 8x8 tiles, drawn using exactly your method (taking a piece out of a dynamic sprite holding all 58 tiles), at mouse position, every game loop.

Slowdown & Flickering: 0, AGS: 1
:)
Title: Re: Drawing part of Dynamic Sprite
Post by: Wonkyth on Wed 16/09/2009 06:15:45
I'm liking the sound of this tile engine...
Title: Re: Drawing part of Dynamic Sprite
Post by: Crimson Wizard on Wed 16/09/2009 12:44:10
Quote from: wonkyth on Wed 16/09/2009 06:15:45
I'm liking the sound of this tile engine...
(Almost) Every guy or girl who gets his/her hands on programming language decides to create his own tile engine sooner or later  ;D
Title: Re: Drawing part of Dynamic Sprite
Post by: Wonkyth on Wed 16/09/2009 13:11:44
Exactly the reason I haven't! :P
But knowing that there is a well coded AGS tile engine around will make things nice, as I'm still a tad dodgy when it comes to scripting...
Title: Re: Drawing part of Dynamic Sprite
Post by: Khris on Wed 16/09/2009 13:54:48
I'm planning on it being capable of most of what Zelda: The Minish Cap does.
Those are really high stakes of course, but if I fail at half of that, I'll still have a decent engine :=
Title: Re: Drawing part of Dynamic Sprite
Post by: Crimson Wizard on Wed 16/09/2009 15:12:38
Quote from: Khris on Wed 16/09/2009 13:54:48
I'm planning on it being capable of most of what Zelda: The Minish Cap does.
Those are really high stakes of course, but if I fail at half of that, I'll still have a decent engine :=
Never played Zelda, so googled for screenshots; heh, it may be interesting ;).

Anyway, I am feeling this goes offtopic, I am marking this thread "solved".