Page 4 of 7
Re: Setting Animation for Actor

Posted:
Thu Mar 27, 2014 10:51 pm
by Turon
Okay I've just revized the code! it will revert the players animation to a standing posture upon collision with ground in the action of holding down the jump key,
however it will not stop the player from jumping over & over again with the action of holding down the jump key. Other bugs include the inability to pass onto a walking animations after the event.
- Code: Select all
char *key = GetKeyState(); //Get entire keyboard state
if(key[KEY_x] == 1)//TEST IF X IS PRESSED
{
jump=1;
}
if (animindex==5)
//PlayJumpLeft is animindex 5
{
ChangeAnimation("Event Actor", "PlayerStillLeft", FORWARD);
}
if (animindex==6)
//PlayerJump is animindex 6
{
ChangeAnimation("Event Actor", "PlayerStillRight", FORWARD);
}
Re: Setting Animation for Actor

Posted:
Fri Mar 28, 2014 9:35 am
by lcl
Think about your code.
Look at it and think for answers for these questions:
1. When to code is activated?
2. When the variable jump gets set to 1 - when are you allowing the character to jump again?
3. When shoukd the character be allowed to jump again?
4. When does the animation changing occur? (When is the code activated?)
There is two things that need fixing, and they cause the problems you mentioned. Thinking about what your code actually does and when it does it, helps you to see what is wrong.
Re: Setting Animation for Actor

Posted:
Mon Mar 31, 2014 9:22 am
by Turon
Hang on I'm just thinking about it now, I'll report when something happens.
Re: Setting Animation for Actor

Posted:
Sun Apr 06, 2014 9:07 pm
by Turon
So if I need to start understanding the code more lets start with the != stuff in the code,
I know that "!=" means not equal to, but why can't it just be as easy as changeing number values?
Re: Setting Animation for Actor

Posted:
Tue Apr 08, 2014 1:52 pm
by Turon
I have figured out the != part now I just need to figure out the reason why the player will not return to a walking posture after the event takes place,
I have figured that "jump == 1" actually means that you aren't jumping. hmmm.......... don't worry I'll work it out eventually

!
Re: Setting Animation for Actor

Posted:
Tue Apr 08, 2014 3:40 pm
by lcl
Could you post your current version of the ged with the data and I'll see what's wrong and then give you instructions for fixing it?
Re: Setting Animation for Actor

Posted:
Tue Apr 08, 2014 6:38 pm
by Turon
Okay Here the ged is... why do I have an odd feeling that the answer is right under my big nose?
Re: Setting Animation for Actor

Posted:
Mon Apr 14, 2014 9:36 pm
by Turon
Is it something to do with the jump variable? Whatever it is something is forbidding the left and right walking.
Or maybe for some reason the left and right walking is no longer being triggered?
Re: Setting Animation for Actor

Posted:
Mon Apr 14, 2014 11:04 pm
by lcl
Oh, sorry, I forgot to answer you..
The reason why it doesn't allow the walking animations to play is that you still didn't check if the jump key is not pressed, in other words, if
KEY_x == 0. You checked if it was pressed and that caused him to not change his animation back to walking.
However, making it check if the key is not pressed doesn't still solve all problems.
The easiest fix is to just leave the whole check away.
Sure, this makes the actor jump immediately when touching ground if you're still holding the jump button, and that is another problem. That problem can be solved by setting the repeat of the x key down event to disabled, but then another problem appears, in the form of the character doing funny movement when you land from a jump and keep holding x down. And that can be solved by doing this:
- Remove the key[KEY_x]!=1 conditions from the 5th and 7th if's in the draw actor code
- Replace the key[KEY_x] == 1 from the 9th and 12th if's in the draw actor code with jump==0
The reason why this is so complicated is because of how you manage your movement. Having it all based on what keys are pressed and what aren't makes it very difficult to follow what is happening in the code when playing. I'd suggest you to learn the state method (search "state method" on the game editor wiki).
Re: Setting Animation for Actor

Posted:
Tue Apr 15, 2014 7:13 pm
by Turon
Forgive me for my ignorance but what is this state method everyone's talking about? Is that the reason I suck so hard with Programming?

Re: Setting Animation for Actor

Posted:
Tue Apr 15, 2014 7:46 pm
by lcl
State method is one method of handling character movement and animation changing.
As I told you, search the Game Editor wiki with the words "State method" for more information.
And you don't actually possibly suck at coding, it's just that the system you use for movement currently makes it pretty much impossible
to have everything working as you want, because every piece of code interferes with the other pieces. State method can help you say goodbye to that problem.
Re: Setting Animation for Actor

Posted:
Thu Apr 17, 2014 2:56 pm
by Turon
Thank. I'm working on learning state method right now.
Re: Setting Animation for Actor RENEWED TOPIC

Posted:
Tue May 06, 2014 7:02 pm
by Turon
I have compleatly changed the movement system based on the UnproPro's How to Make a Game Tutorials. The Jumping animation play flawlessly,
The Shooting animation seems to be the problem now. Also I am reworking the graphical style.
Re: Setting Animation for Actor RENEWED TOPIC

Posted:
Mon May 12, 2014 7:46 am
by Turon
The shooting is a little funny now I don't really know what to do since the new movement engine is so different.

So where do I go from here? I myself have tried I busted my brain trying to figure it out.
It is clear we need more than one brain to figure this problem out.
Re: Setting Animation for Actor RENEWED TOPIC

Posted:
Wed May 14, 2014 9:42 am
by Turon
Hang on I think I'm getting somewhere I'll report back if there is any trouble.