(SOLVED) Problem with emode lookat without up and down loops.

Started by , Mon 18/09/2006 06:44:29

Previous topic - Next topic

peladovii

Hello, I'm having some troubles.

As i can't draw i decided to use only left-right loops for character walking, so i leave loop 0 empty. the problem comes when i look at a hospot:Ã,  i get this message: "The Character Roger cannot be displayed because there were no frames in loop 0 of view 5".Ã,  Well i dont know why this happen after "looking" where he speaks in View 6 and should return to View 5 (Normal) and thats where the crash comes.Ã,  Ã, it must be automatic . I'm using this code to look.

if (button == eMouseRight) {Ã,  Ã, // right-click,Ã, 
Mouse.Mode = eModeLookAt;
ProcessClick(mouse.x, mouse.y, eLookAt;
}

Maybe there something in automatic the eMode that make the program to use loop 0. Efectively when I add a sprite to this loop, after processing the "look" action it gets back to loop 0 but it doesnt work for me since i need the character in the last position and facing before the click.

I also disabled "character Turn to Face direction" and "character Turn before walking" with same results.
Well any idea will be appreciated, thanks.

Barbarian

You could simply add in the sprites for the "Up" and "Down" loops. I think that a character requires at least the 4 main loops for a view: Down, Left, Right and Up.
However, as you only just want Left and Right, you could "trick" it by simply adding in the sprites for "Down", perhaps just have the same sprites for the "Down" view to be the same as if the character was facing "Right", and for "Up", use the same sprites as if the character was looking "Left". That way you'll have the minimum 4 directions / loops filled in with something and it should work fine then.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Khris

Quote from: Barbarian on Mon 18/09/2006 12:16:30perhaps just have the same sprites for the "Down" view to be the same as if the character was facing "Right", and for "Up", use the same sprites as if the character was looking "Left".
That'll look wierd if the character walked down and a bit to the left, or up and a bit to the right.
A workaround is to use two views, one where the up and down loops are filled with the sprites facing right and one where they're facing left.
Then use this code:
Code: ags
 // on_mouse_click, before ProcessClick(mouse.x, mouse.y, eWalkTo);
if (mouse.x > player.x) player.ChangeView(R);
else player.ChangeView(L);

Just replace R and L with the numbers of the views.

peladovii

#3
Thanks Barbarian and KhrisMUC for your replyes. Effectively with the code khris suggested workedÃ,  swell. I only had to apply it to the speech view. thanks a lot.
Btw, when it is like 3 cms close to the right it recognize as mouse.x < player.x but I'm thinking that it is taking the invisible square where the player was imported like part of the character, i guess i'll have to reduce unuseful space, please correct me if I'm wrong.
bye

Edit: After trying a little bit i ralised that mouse.x  is from 0 to 320(what is seen in the screen) while player.x is in room coordinates. since i have a scrolling background (800x200) when the player is on room coordinates 321 or higer player.x is always bigger than mouse.x.
Is there a way to convert either mouse.x to room coord. or character.x to screen coord?

Gilbert

Use
mouse.x + GetViewportX ()
to get the room x-coordinate.

(and mouse.y + GetViewportY () if it's scrolling vertically also, which is not in your case)

peladovii

Problem Solved: thank you all very much for your help!

SMF spam blocked by CleanTalk