Hi, i'm trying to do a platformer game and i put the character movements with no problem. Then, discovering the program, i bumped into some problems, here it is:
1 - When i press left or right arrow during the jump action the character start to walk in the air until touch the ground.
2 - When i press "x" button (attack button) the character does the animation and freeze in the last frame until i press any button to "defrost" the animation. If i hold movement button and then press "x" the character does the animation while is moving.
3 - If i hold right arrow, press left whitout releasing right and then release right arrow the player stays on iddle animation and move backwards.
I hope you guys can help me.
Develop games in your browser. Powerful, performant & highly capable.
First, this is the wrong sub-forum for this. You should get help elsewhere... this sub-forum is for people seeking paid or volunteer help in gaming projects.
Here is a quick and dirty solution to your problem... which still has some problems. There is a cleaner solution to this, but I think you need to at least see why I did what I did to help improve your programming skills. You should be able to add more condition checks to your code to make sure that the character movement code is impeccable.
PROBLEM 1 & 3 -
Create a new global flag called B_Moving. When B_Moving is TRUE (or equals one), that means your character is moving.
Also create a new global flag called B_Jumping. When B_Jumping is TRUE (or equals one), that means your character is jumping.
Make the following changes by adding the lines printed in bold:
MODIFY Line 1:
Keyboard -> On Left arrow pressed AND
System -> B_Moving = 0
System -> B_Jumping = 0
Sprite -> Set animation to "Walking" (play from beginning)
Sprite -> Set Mirrored
System -> B_Moving = 1
MODIFY Line 2:
Keyboard -> On Right arrow pressed AND
Sprite -> Set Not mirrored
MODIFY Line 4:
Keyboard -> On Right arrow released AND
Sprite -> Set animation to "Idle" (play from beginning)
MODIFY Line 5:
Keyboard -> On Left arrow released AND
Sprite -> Set mirrored
Start ignoring Platform user input
MODIFY Line 6:
Keyboard -> On Up arrow released
Sprite -> Set animation to "Jumping" (play from beginning)
System -> B_Jumping = 1
ADD Line #10:
Sprite -> On collision with Sprite2
System -> Set B_Jumping = 0
PROBLEM 2 -
ADD Line #11:
Sprite > On animation "Attacking" finished
Sprite > Set animation frame to 0
Hope that helps!
<img src="smileys/smiley2.gif" border="0" align="middle" />
I don't even try yet but thanks. As i try i'll post the result.