Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: YMH on March 25, 2007, 09:37:33 PM

Title: Adjusting Walking Speed and Zooming
Post by: YMH on March 25, 2007, 09:37:33 PM
Hi there,

Two different things I'm trying to do that I figured I'd ask about in the same post.

The first is adjusting a 2D actor's walking speed through script, to do things like double-click to run, or having the same actor move at different speeds in different scenes? Is there a way to do that, or would I have to make different actors that use different sprites that are made up of the same bitmaps with different walk-to speeds?

The second thing I'm trying to figure out how to do is zoom the camera in and out on a scene, so that I can use high resolution backgrounds and characters and have closeups on conversations and such without having to create seperate scenes for them. Does the engine have such a feature at the moment?

Thanks in advance!
Title: Re: Adjusting Walking Speed and Zooming
Post by: YMH on March 26, 2007, 12:26:54 AM
And another question while I'm at it:

Is there a way to find out which region contains an actor or entity at any given moment?

I tried calling Scene's GetRegionAt() method (passing in the actor position) but that always seems to return the frontmost region at that position, whereas (at least in terms of Z ordering) it appears that the backmost region at a given position is the region that contains actors and entities that are at that position.

Thanks!
Title: Re: Adjusting Walking Speed and Zooming
Post by: adonf on March 26, 2007, 09:58:34 AM
For your second post, the game sends events "ActorEntry" and "ActorLeaves" to the regions when the actor Enters or leaves, if you have only one actor then you can try to use this.
Title: Re: Adjusting Walking Speed and Zooming
Post by: YMH on March 26, 2007, 01:09:41 PM
But doesn't a game typically have several regions per scene? It seems that having individual scripts for all of them could quickly grow unweildy.
Title: Re: Adjusting Walking Speed and Zooming
Post by: Mnemonic on March 26, 2007, 05:30:38 PM
That's right, GetRegionAt only returns the top-most region. There's an optional parameter to ignore decoration regions, though.

Quote
The first is adjusting a 2D actor's walking speed through script, to do things like double-click to run, or having the same actor move at different speeds in different scenes? Is there a way to do that, or would I have to make different actors that use different sprites that are made up of the same bitmaps with different walk-to speeds?
You'd have to use a different actor (you'll probably need to use a different animation for running anyway...).

Quote
The second thing I'm trying to figure out how to do is zoom the camera in and out on a scene, so that I can use high resolution backgrounds and characters and have closeups on conversations and such without having to create seperate scenes for them. Does the engine have such a feature at the moment?
No, not a native support for anything like that. Of yourse, you could make your own entity and set its scale etc.
Title: Re: Adjusting Walking Speed and Zooming
Post by: YMH on March 26, 2007, 06:37:08 PM
So there's no way at present to retrieve or determine the region whose Z order is currently determining the Z order of a given actor?

And there's also no way to swap out an actor's walking sprites on the fly?

Thanks.
Title: Re: Adjusting Walking Speed and Zooming
Post by: Mnemonic on March 26, 2007, 07:11:26 PM
It's sad but it's true.
Title: Re: Adjusting Walking Speed and Zooming
Post by: YMH on March 27, 2007, 05:06:53 AM
Hmm... well, let me explain what I'm trying to do; maybe there's a better way than what I've come up with so far.

In short, I want my actor to be able to switch between an ordinary walking state, and a flying state. When the actor is in the flying state, unlike normal walking, its scale shouldn't change when it moves around on the Y axis, and neither should its z-order.

So what I tried was dynamically creating a region and sticking my actor to it while it was in the flying state, and overriding my actor's scale with its dynamic scale at the time of take-off. For the most part that worked, but I wasn't able to figure out where in the z order to put the region that I created -- so while the z-order was consistent, it was consistently incorrect.

So is there a better way to make a character fly in WME, or is it just beyond the scope of the engine at the moment? The only way I can think of to make it work is to allow the character to switch to the flying state only at a defined point on each screen, but I was hoping to give the player a bit more flexibility than that.
Title: Re: Adjusting Walking Speed and Zooming
Post by: Mnemonic on March 27, 2007, 12:16:02 PM
So, basically, you'd need some method like Scene.GetRegionsAt(), that would return an array of regions at certain point in scene?
Title: Re: Adjusting Walking Speed and Zooming
Post by: YMH on March 27, 2007, 01:24:25 PM
Yeah, it sounds like that would be enough to get flying to work using the technique that I had in mind.