Why can't i make a enemy jump?

Get help using Construct 2

Post » Wed Jul 15, 2015 10:27 am

To make a enemy move left and rigfth you make a instance variable action and type rigth. You add a platform behavior and change default controls to no. Then you make the event action equals to "rigth", simulate control rigth, set not mirrored and do the same for left but set mirrored. Then you do a couple of events and actions whit the edgemarkers to make the enemys turn. I would imagine jump would be similiar. You make instance variable named action2 and type in jump. Then you make the event action2 equal to "jump" and simulate control jump. No mirroring or edgemarkering is needed since the enemy just jumps. Of course you change defualt controls to no. I have done exactly this for multiple enemies and they don't jump. I have answered this question multiple times before and the replies indicated that it should work the way i do it. But it doesn't do it for me. is it something wrong whit my Construct 2, a bug or something? Make a enemy jump seems so simple but it seems incredibly hard for me for some reason.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Wed Jul 15, 2015 10:45 am

If you could share your events and/or capx it would be easier to answer..
I don't think there is any bug or something wrong with (your) Construct2

Right now, reading your question, I'd have to guess you have multiple events cancelling out eachother..
Multiple events/conditions that are true at the same time and because construct2 reads events from top to bottom, probably only the last event is acted upon.
But like I said, without seeing the way you've set up your events this is only a guess..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jul 15, 2015 2:14 pm

LittleStain wrote:If you could share your events and/or capx it would be easier to answer..
I don't think there is any bug or something wrong with (your) Construct2

Right now, reading your question, I'd have to guess you have multiple events cancelling out eachother..
Multiple events/conditions that are true at the same time and because construct2 reads events from top to bottom, probably only the last event is acted upon.
But like I said, without seeing the way you've set up your events this is only a guess..



Too bad i can't post links to images until i have 300 in reputation. I would send links to my event sheet in every question i asked if i now could. No of my events cancel jumping so i it would not matter how far up the event is.
I try to show the event sheet i have here as good as possible.
action4 = jump Simulate Platform pressing Jump
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Wed Jul 15, 2015 2:21 pm

Could it be that when you check if action4 is jump, you are checking if action2 is something else and that condition is also true

Why use action4=jump and not just action=jump?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jul 15, 2015 2:29 pm

LittleStain wrote:Could it be that when you check if action4 is jump, you are checking if action2 is something else and that condition is also true

Why use action4=jump and not just action=jump?




The reason why i named it action4 was becuase i have anothger enemy whit a instance variable nmed action and i thaugth both couldn't share that name. I changed the name to action and it still was okay so now the name is just action. It still didn't make the enemy jump though. My other instance variable is the enemys health counter in case you were curious. The enemy do jum exactly when the game starts for some reason but not after that. I tried adding every tick and then jumping event but no success.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Wed Jul 15, 2015 2:47 pm

This is expected behavior..
If you would use the default controls and keep the key for jumping pushed it would also jump only one time..
It seems your event is working correctly..

So now the question arises when do you want your enemy to jump and add events and conditions for that..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 16, 2015 12:16 pm

LittleStain wrote:This is expected behavior..
If you would use the default controls and keep the key for jumping pushed it would also jump only one time..
It seems your event is working correctly..

So now the question arises when do you want your enemy to jump and add events and conditions for that..



great! atleast we are making progress! I made the event like this.

Every 1,0 seconds
action=
"jump" Simulate control pressing Jump

The enemy doesn't jump

Then i skipped the action=
"jump"
Didn't work.

Then i made

Has Line of Sigth of Sprite
action=
"jump" simulate control pressing jump


That didn't make the enemy jump but it did make the enemy glitchy enough move to the rigth until it hit a wall when the game started. It doesn't have any events that make it move left and rigth so that is special. So how should i set up the events if i want to choose when the enemy is going to jump?
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Thu Jul 16, 2015 12:25 pm

Could it be the collision polygon of your sprite is overlapping a solid?
If so the jumping won't work...
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 16, 2015 12:50 pm

LittleStain wrote:Could it be the collision polygon of your sprite is overlapping a solid?
If so the jumping won't work...



No it doesn't It stands on a solid object but the collison polygon is on the solid object. I guess making a enemy jump is impossible for me how hard i an try. How sad....
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Thu Jul 16, 2015 1:01 pm

It shouldn't be hard..

Your code should work..

Jump example
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: marc254, Yahoo [Bot] and 6 guests