Page 1 of 2
Attack direction.
Posted:
Wed Jan 05, 2011 10:42 pm
by bubblemaster123987
Hey everyone. I'm still new to GE so any help is appreciated.
I'm having some issues with making my attack actor face the same direction as my main actor. As stated, they are separate actors. The attack actor has two animations, one for each direction, and I was wondering if anyone could help me figure out how to get the attacking actor to face the same way as my main actor without having two separate attack buttons. Attacking is currently done with the following: Keydown: Left Alt: Destroy actor/Create Actor. That's for the main character. Then for the attacking actor it's: Animation Finish: Destroy Actor/Create Actor. But of course, the attacking actor only comes in facing one way no matter what direction the main actor is facing. Thanks to anyone who can help with this problem.
P.S. I'm also having an issue where when the attack button is pressed, it creates two actors instead of one, each facing a different direction, and then they disappear and leave two main actors. Again, any help appreciated.
Re: Attack direction.
Posted:
Wed Jan 05, 2011 11:04 pm
by AliceXIII
it would be much easier if you just added the attack animations to your main actors sprite sheet and just call that sprite sequence when the attack button is pressed it would solve this problem
Re: Attack direction.
Posted:
Wed Jan 05, 2011 11:09 pm
by bubblemaster123987
If it wouldn't be a bother, do you think you could maybe post an example? 'Cause I'm not really getting how that works.
Re: Attack direction.
Posted:
Wed Jan 05, 2011 11:18 pm
by AliceXIII
well if you have it all on one sprite sheet the walking and fighting animations.
all you have to do is under actor control click the add sequence button and name it like attack right etc etc.. and just pick the frames out individually from the sprite sheet.
Re: Attack direction.
Posted:
Wed Jan 05, 2011 11:23 pm
by bubblemaster123987
Okay, that part worked. Now how do I get it to only play that one direction when he's facing that direction standing still? Sorry for having to ask a bunch of questions, I'm just really bad at figuring stuff out.
Re: Attack direction.
Posted:
Wed Jan 05, 2011 11:27 pm
by AliceXIII
it is'nt a problem you get better by asking questions
but do you mean like if you were walking and stopped for his animation to stop in that direction?
Re: Attack direction.
Posted:
Wed Jan 05, 2011 11:54 pm
by bubblemaster123987
Huh... I'd like to send a video to you to show you what's going on but GE forms aren't letting me so, to put it the most descriptive I can, I can walk and fly fine, and if I were facing right all the time, the attack would work, 'cause when I press the button that's what way the attacking sprite is facing. But, since I'm not always facing right, I need to make it so that he'll attack left or right depending on the direction of the actor before I press the button. And then also to get it so he returns to that same direction when the attack is over.
Re: Attack direction.
Posted:
Thu Jan 06, 2011 12:30 am
by AliceXIII
instead of posting a video we post .ged files of the current project.
but all you have to do to get him to attack in the direction you want if he's facing that direction is in the key down event for the attack you can make a script and say:
- Code: Select all
if(getAnimIndex("left or right animation")
{
ChangeAnimation("character", "battle animation", Forward or Backwards, Stopped or None);
}
and just do this for all your differnt directions should work.
and also to get the actor back to the animation of standing still in that direction after attacking
just put this after the last bracket of the if statement:
- Code: Select all
ChangeAnimation("character", "the idle left or right animation", forward or backwards, stopped or none)
Re: Attack direction.
Posted:
Thu Jan 06, 2011 12:56 am
by bubblemaster123987
- Code: Select all
if(getAnimIndex ("StillRight")
{
ChangeAnimation ("Player", "AttackRight", Forward);
}
Now I'm not sure if I got any of this right, but I just kinda, filled in what looked like it was supposed to be changed. StillRight is the name of the standing file, Player, the name of the actor, and AttackRight, the name of the attacking sequence, and I'm not sure if Forward there is right or not, so feel free to correct of course.
Re: Attack direction.
Posted:
Thu Jan 06, 2011 1:05 am
by AliceXIII
it all looks correct
the forward and backwards is for if your facing that way but you could put none there if you wanted to.
Re: Attack direction.
Posted:
Thu Jan 06, 2011 1:12 am
by bubblemaster123987
Hm. Odd, it's still not working. I put in the code, and it says that there are two errors. Error line 3: Expected (, and Error line 5 (Which is odd 'cause there is no line 5 yet) Expected ;.
Re: Attack direction.
Posted:
Thu Jan 06, 2011 1:20 am
by AliceXIII
considers any line that was any symbol on it a full line so it considers the single brackets { a line.
but that means that you forgot to put this ( at the end of change animation and forgot a ; at the end of the change animation function.
should work if you correct those.
Re: Attack direction.
Posted:
Thu Jan 06, 2011 1:24 am
by bubblemaster123987
I can't say I know exactly what you're talking about, so I'm going to give you the file and see if you can find the problem.
Re: Attack direction.
Posted:
Thu Jan 06, 2011 1:27 am
by AliceXIII
have to post the dat folder to the one that has the images your using or i cant see what your doing
Re: Attack direction.
Posted:
Thu Jan 06, 2011 1:29 am
by bubblemaster123987
Do you think you might be able to tell me how to get to that particular file/image?