Page 1 of 1

mirror image

PostPosted: Sat Sep 08, 2007 9:00 pm
by jagheera nex
im making a simpole stickman type game and right now i have two main actors, one to go one way and one to go the other way, i did it that way cuz if i do only one actor there would be 2 atacking animations and i don't know how to make the game reconize when the actor is facing one way or another. i think if i can flip the actor horizontily left or right it would solve the problem but i don't know how to program that, someone plz help.

Re: mirror image

PostPosted: Sun Sep 09, 2007 5:50 pm
by Troodon
Game editor can't yet rotate and flip animations but this can be simulated with some ways.
You can for example create a variable which could be -1 when actor looks left and 1 when he looks right. Then just check this and use the needed animation. :)

Re: mirror image

PostPosted: Sun Sep 09, 2007 6:21 pm
by jagheera nex
oh i get it so i make a varible 4 each way he is looking and when he looks that way i,... do what exactly, im feel so newbish

Re: mirror image

PostPosted: Tue Sep 11, 2007 3:25 am
by jagheera nex
if you can, can you plz answer in a code pleese :D im not good at reading

Re: mirror image

PostPosted: Tue Sep 11, 2007 6:13 pm
by Troodon
Sorry for not being specific. I was writing in a hurry. (I'm also now writing in a hurry) :lol:
However, you can make like this:
Go to 'attack key down' -> script editor
then create a variable called compass
Then add this code
Code: Select all
if (compass == -1)
{
ChangeAnimation("Event Actor", "attacktoleftanimation", FORWARD);
}
if (compass == 1)
{
ChangeAnimation("Event Actor", "attacktorightanimation", FORWARD);
}

Then add this in the key down of the key when you walk right:
Code: Select all
compass = 1;

and in the key down event of the key when you walk left:
Code: Select all
compass = -1;

And still a small thing, in the create actor of your character:
Code: Select all
compass = 1; //if the actor is looking to right in the beginning


I hope this helps.
NOTE: This is how to do it with left and right! If your game has for example 4 directions, just use 4 compass values. I used -1 and +1 just because it's easy to remember which one is left and which one right. :)

Re: mirror image

PostPosted: Tue Sep 11, 2007 11:35 pm
by jagheera nex
thanks so much man works like a charm, lol :D

Re: mirror image

PostPosted: Wed Sep 12, 2007 4:42 am
by Troodon
No problem! :D