Turon wrote:This is all getting very complicated....
Turon wrote:-Edit- 1/11/2015
I have overcome these problems with better code!
Hares wrote:Turon wrote:What do you mean by 2 else and 1 if?
Your code is like this:
if (check some thing)
{
do some thing;
}
else
{
do some thing else;
}
else
{
do some thing else (again );
}
}
It is the red part that makes your code unacceptable.Turon wrote:Sorry to confuse you but my code had a typo so I typed "IF Z IS PRESSED AND X" which was meant to be "IF Z IS PRESSED AND NOT X"
I modified that in the code below.
So I suggest you copy the code below here (push the select all button)
Then in your .ged you erase your code, and replace it by the one you copied.
See if it gets accepted.
If (so)
{
figure out what is different from your code, and try to understand it;
}
else
{
report back here;
and we try to help you figure it out;
}
else
{
forget about the second else ...
}
}
- Code: Select all
char* key = GetKeyState();
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 0)
{
// IF KEY RIGHT IS PRESSED AND NOT LEFT
if(key[KEY_x]==1)
// AND THEN IF X IS ALSO PRESSED
{
ChangeAnimation("Event Actor", "PlayerJumpRight", NO_CHANGE);
}
if (key[KEY_z]==1 && key[KEY_x]!=1)
{
//IF Z IS PRESSED AND NOT X
ChangeAnimation("Event Actor", "PlayerShootRight", NO_CHANGE);
}
if (key[KEY_x]!=1)
{
// BUT IF X ISN'T PRESSED
x+=3;
ChangeAnimation("Event Actor", "PlayerMoveRight", NO_CHANGE);
}
}
if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0)
{
// IF KEY LEFT IS PRESSED AND NOT RIGHT
if(key[KEY_x]==1 && key[KEY_z]==1)
{
// AND THEN IF X IS ALSO PRESSED
ChangeAnimation("Event Actor", "PlayerJumpLeft", NO_CHANGE);
}
if (key[KEY_z]==1 && key[KEY_x]!=1)
{
// IF Z IS PRESSED AND NOT X
ChangeAnimation("Event Actor", "PlayerShootLeft", NO_CHANGE);
}
if (key[KEY_x]!=1)
{
// BUT IF X ISN'T PRESSED
x-=3;
ChangeAnimation("Event Actor", "PlayerMoveLeft", NO_CHANGE);
}
}
Users browsing this forum: No registered users and 1 guest