krenisis wrote:Click on add//click on key down//now a tab will open up//it will ask you what button you want to press// press the right arrow on computer//click on add action//click on script editor//put this code in which make your charactor move right
x+=10;
Go to the variables/functions tab on bottom of screen and click on change animation and choose the animation you want your player to have when you press the button.
then click ok//immediate action
Now you be taken back to the tab//press clear button//press left key//click on add action//click on script editor//put this code which makes your charactor move left
x-+10;
Go to the variables/functions tab on bottom of screen and click on change animation and choose the animation you want your player to have when you press the button.
click ok// immediate action
You have done much work with this, and that's great you help people.
But your tutorial has one problem. It's moonwalk. Mario starts the animation all the time again while you press left or right, and that's looking bad. I had the same problem in my Elephant game and I didn't even notice it first, but when I had a look to my real animations like what they should be, I found out that my actor keeps repeating two first frames of animations all the time while moving. But it's easy to fix.
Add variable called direction (or what you want) and then change the moving script to be like this:
(key right)
- Code: Select all
x+=10;
if(direction!=1)
{
ChangeAnimation(blah blah blah all this... xD);
direction=1;
//First line checks if the value of direction is some else than 1
//Second line changes the animation
//And third line makes direction equal to 1, so it can't repeat changing animation
}
This way the variable direction can hold all the directions, then you just have to decide different values for all directions and change them to the code.
I hope this helps you to help people!