Walk on a special path and use the view

Started by Mehrdad, Tue 31/03/2015 05:56:03

Previous topic - Next topic

Mehrdad

Hi

I have a thin diagonal passage scene with diagonal NE/SW walkable area.I only want use View NE/SW from character walking when I click on this way . I don't want use auto walking from first position to end position .Is it possible?
My official site: http://www.pershaland.com/

st.

Use a different view, just for that scene, where down and left loops contain the same 'NE/SW' walking direction frames?
springthoughts

Mehrdad

#2
Your mean is I have to change player with only two views for this scene?
My official site: http://www.pershaland.com/

Monsieur OUXX

I'm not sure I understood your question.
What do you NOT want?
- You don't want the game to display the  N/S/E/W character views during that scene, only the NE/SW views?
OR
- You don't want the game to use the pathfinder and allow the player to walk anywhere the player clicks? You only want the character to be able to walk on a straight NE/SW line?
 

Mehrdad

#4
I want use pathfinder and allow player click and walk on straight NE/SW line only.and don't show other animations like left or right or...  Also I want turn before walking method too.
My official site: http://www.pershaland.com/

st.

Define another view that you will use only for that diagonal path. You don't need to change the playing character, just the normal view(=walking view) for it.

I use the word view according to AGS terminology: a view contains a series of loops and is associated to a character; in our case, for walking. The special view (for diagonal walking in your scene) would contain in loops 0(down) and 1(left) the frames that show the character facing SW; you may also want in loops 2(right) and 3(up) the frames that show the character facing NE.

The easiest way to change the view when walking on that path is to set the property AreaSpecificView of the walkable area defined for the diagonal path to the number of the special view.

This method assumes that you use only one playing character with that specific room. I have no experience with changing walkable area properties from inside the script. Perhaps someone else can add light on this matter?

If you want to use more than one playing character with that scene, in other words if you change you playing character throughout the game but the scene repeats, then the easiest way would be to use ChangeView. If your current playing character is cEgo and the normal (walking) view associated to it is vEgo, having the number 4, and the special view is vEgo2, having the number 5, then you would write cEgo.ChangeView(5) in room_Load() and cEgo.ChangeView(4) in room_Leave() - assuming that you use a whole room for that diagonal path walking scene.

If you want to use only a part of a room for your scene, things get a little more complicated :)
springthoughts

Mehrdad

Sorry I couldn't do it yet. I want it for a part of room . AFAIK I have to use region for it .But I don't know how is it. I saw this walking in The Broken Sword game.
My official site: http://www.pershaland.com/

st.

Hm, my last reply seems to be poorly organized... You may have understood that nothing I wrote would apply to your case because your diagonal pathway is only a part of a room? I still think that setting AreaSpecificView for the walkable area defined over the diagonal pathway would work in your case, assuming that you use only one playing character throughout the game. Did you try that?

In any case, can someone more experienced please step in and help this guy? I don't seem to be at my tutoring best :)
springthoughts

st.

A thought about using a region, although I have no experience with them:

Define a region for the diagonal pathway.
In room_RepExec() place code similar to
Code: ags
if (Region.GetAtRoomXY(player.x, player.y)==region[DIAGONAL_PATH_REGION_NUMBER]) {
    if (player.NormalView==VBOB1) player.ChangeView(VBOB2);
    else if (player.NormalView==VANNE1) player.ChangeView(VANNE2);
    // else if...
}
else {
    if (player.NormalView==VBOB2) player.ChangeView(VBOB1);
    else if (player.NormalView==VANNE2) player.ChangeView(VANNE1);
    // else if...
}

where DIAGONAL_PATH_REGION_NUMBER is replaced with the number of the region; the notation I used suggests defining a constant.
This solution covers all possible playing characters that one may use.

I still hope that someone more experienced will share some information or at least confirm my solution for you; and me :)
springthoughts

st.

Obviously it's rather bad practice to have a test repeated (in room_RepExec) when you should have it only at specific events: player walks onto region and player walks off region. As it turns out, the AGS Editor allows you to define functions for these events! Boy, did it take me long to find out :) I suppose you know how to define a region. Then click on the orange lightning button and on the "..." buttons for Walks off region and Walks onto region.
Write the lines
Code: ags
if (player.NormalView==VBOB1) player.ChangeView(VBOB2);
    else if (player.NormalView==VANNE1) player.ChangeView(VANNE2);
    // else if...
in regionX_WalksOnto()
and the lines
Code: ags
if (player.NormalView==VBOB2) player.ChangeView(VBOB1);
    else if (player.NormalView==VANNE2) player.ChangeView(VANNE1);
    // else if...
in regionX_WalksOff(). I suppose this will do.
There, I learned something new today! Thank you for the opportunity :)
springthoughts

SMF spam blocked by CleanTalk