[21 Dec 2009] Trying to set up Anim as ingame character.

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
Bugala
Posts: 1412
Joined: Sun Feb 14, 2010 7:11 pm

[21 Dec 2009] Trying to set up Anim as ingame character.

Post by Bugala »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 21 Dec 2009 05:57:39 -0000

Im trying to set up enemy as animlayer, I dont know if this is the best way to do it or not, so you can also suggest me using somethng different.

Idea is that for example when enemy walks, i would keep changing frames in anim to make it look like its walking, and when enemy dies, display different frames of that animlayer.

However, i have trouble getting animlayers to display.

So this is what im doing currently:

Code: Select all

LoadBrush(1, "source" {Transparency=$FFFFFF})
CreateAnim(2, 1, 50, 50, 1, 1)
PlayAnim(2, 100, 100)
DisplayAnimFrame(2, 100, 100, 1)
Now i do know source of brush is right, since i can displaybrush and it shows it correctly and even move it around.

It also seems that Animation does exist in some form there, since i can name that animlayer as "Enemy1" and it doesnt complain about layer being out of range and other setlayernames i have further in the code apply to right layers.

For if that anim layer wouldnt exist, then all the setlayernames would apply to IDs of 1 too early (as happened earlier when i didnt get animlayer to exist at all yet)

However, it doesnt display anything.

For shouldnt this piece of code already display the brushes image on animlayer? being a stable image?

Here is also the whole code i have so far, it can be run with Cubic IDE directly wihtout any changes, except that its missing the source image of brush:

http://dl.dropbox.com/u/3375468/Snowbal ... ngpart.hws

And if you check the whole code, you can also suggest me better snowball flying formula, it works but it doesnt feel too good.
Bugala
Posts: 1412
Joined: Sun Feb 14, 2010 7:11 pm

[22 Dec 2009] Re: Trying to set up Anim as ingame character.

Post by Bugala »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 22 Dec 2009 05:26:40 -0000

I got that problem solved.

Seems problem was with source image, for i thought it would automatically scale that vrsh to right size when put to anim, but instead it only took that 50x50 part from the source brush, and since that brush had transparent parts and waas quite big, it happened that on that 50x50 size there was nothing else but ransparency, and hence it became invisible and i thought it wasnt working

by using scalebrush first i got it to work the way i wanted.

However, one question.

Its seems in order to use setlayername i need to do it this way:

Code: Select all

Createanim()
playanim()
displayanimframe()
setlaeyrname()
in order to set name for that animframe.

Its not a big problem, but its anyway slightly annoying that i do need to display it twice on screen (playanim and displayanimframe) before i can name it and start using it the way i want.

I have currently solved this problem by displaying it on - cordinates.

ie.

Code: Select all

playanim(2, -100, -100)
displayanimframe(2, -100, -100, 1)
to avoid it being shown on screen before its supposed to be shown.

But is there a way to get that naming done wihtout actually displaying animation anywhere first?

Or at least to display it only once instead of twice?

For if i i leave either PlayAnim() or DisplayAnimFrame() out, it refuses to work.

And i still dont know what that row of frames means?
User avatar
airsoftsoftwair
Posts: 5943
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[22 Dec 2009] Re: Re: Trying to set up Anim as ingame character.

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 22 Dec 2009 22:14:41 +0100
I got that problem solved.

Seems problem was with source image, for i thought it would automatically scale that vrsh to right size when put to anim, but instead it only took that 50x50 part from the source brush, and since that brush had transparent parts and waas quite big, it happened that on that 50x50 size there was nothing else but ransparency, and hence it became invisible and i thought it wasnt working

by using scalebrush first i got it to work the way i wanted.

However, one question.

Its seems in order to use setlayername i need to do it this way:

Code: Select all

Createanim()
playanim()
displayanimframe()
setlaeyrname()
This will actually give you two anim layers: One added by PlayAnim() and one added by DisplayAnimFrame(). If you ask me, you should just use DisplayAnimFrame() and then manually show the anim with calls to NextFrame().
in order to set name for that animframe.

Its not a big problem, but its anyway slightly annoying that i do need to display it twice on screen (playanim and displayanimframe) before i can name it and start using it the way i want.
In Hollywood 4.5 you will be able to assign the layer name right at creation time. It will be possible to do things like:

Code: Select all

DisplayBrush(1, 100, 100, {Name = "MyCoolLayer"})
DisplayAnimFrame(1, ....., {Name = "MyAnimLayer"})
etc.
I have currently solved this problem by displaying it on - cordinates.

ie.

Code: Select all

playanim(2, -100, -100)
displayanimframe(2, -100, -100, 1)
to avoid it being shown on screen before its supposed to be shown.

But is there a way to get that naming done wihtout actually displaying animation anywhere first?
In Hollywood 4.5 it's possible as shown above. In Hollywood 4.0 you could also insert a hidden anim layer using InsertLayer(), then do the naming, then show it. It's a little bit more complicated than the 4.5 version but it's also possible.
Or at least to display it only once instead of twice?

For if i i leave either PlayAnim() or DisplayAnimFrame() out, it refuses to work.

And i still dont know what that row of frames means?
This is only of importance for anims that are stored as image files. Check out the file anim.iff inside the BoingNG example. You'll see that the single anim frames are actually stored inside a huge picture. You'll see that there are 14 frames in a single row. So for this anim.iff file the frames per row must be 14. There's only one row in this example, but there could be more rows. If you set FPR to 14 and set number of frames to 17, then Hollywood would try to read the first 14 frames from row number 1 and the remaining three frames from row number 2.
Locked