Halp, i'm a begginer

Get help using Construct 2

Post » Mon Apr 08, 2013 4:40 am

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.

Here comes:

https://www.dropbox.com/s/5i2vi5048vloy32/6.capx
B
7
S
2
G
1
Posts: 38
Reputation: 917

Post » Mon Apr 08, 2013 6:03 am

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 -

SOLUTION
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:
Condition:
Keyboard -> On Left arrow pressed AND
System -> B_Moving = 0
System -> B_Jumping = 0

Action:
Sprite -> Set animation to "Walking" (play from beginning)
Sprite -> Set Mirrored
System -> B_Moving = 1


MODIFY Line 2:
Condition:
Keyboard -> On Right arrow pressed AND
System -> B_Moving = 0
System -> B_Jumping = 0

Action:
Sprite -> Set animation to "Walking" (play from beginning)
Sprite -> Set Not mirrored
System -> B_Moving = 1

MODIFY Line 4:
Condition:
Keyboard -> On Right arrow released AND
System -> B_Moving = 1

Action:
Sprite -> Set animation to "Idle" (play from beginning)
System -> B_Moving = 0

MODIFY Line 5:
Condition:
Keyboard -> On Left arrow released AND
System -> B_Moving = 1

Action:
Sprite -> Set mirrored
Sprite -> Set animation to "Idle" (play from beginning)
Start ignoring Platform user input
System -> B_Moving = 0

MODIFY Line 6:
Condition:
Keyboard -> On Up arrow released

Action:
Sprite -> Set animation to "Jumping" (play from beginning)
Start ignoring Platform user input
System -> B_Jumping = 1

ADD Line #10:
Condition:
Sprite -> On collision with Sprite2

Action:
System -> Set B_Jumping = 0




PROBLEM 2 -
SOLUTION

ADD Line #11:
Condition:
Sprite > On animation "Attacking" finished

Action:
Sprite > Set animation frame to 0


Hope that helps!
necromaster2013-04-08 06:10:48
=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
10
G
6
Posts: 193
Reputation: 7,584

Post » Mon Apr 08, 2013 7:21 pm

I don't even try yet but thanks. As i try i'll post the result.
B
7
S
2
G
1
Posts: 38
Reputation: 917


Return to How do I....?

Who is online

Users browsing this forum: studio UNNAMED and 4 guests