Enemy moves with only physics

Get help using Construct 2

Post » Fri Mar 09, 2012 10:33 am

Hi everyone.
This is my first post. Ive been playing with construct for about only 2 afternoons, but Ive really felt in love with it.

Im trying to make a platform game without any platform behaviour (why? because I love physics and I love to try making things I still dont know how to make thme).

Im having a problem with enemys movements. Two issues:

  • Im not sure how to make a non playable character moves constantly in horizontal. Im trying to apply forces or speed, and works well, but it gets broken when it collides with a wall for example.
  • If an AI driven character collides with a wall, I apply a force depending on if its mirrored or not, I apply a system wait delay for mirroring it (if I dont delay it wait, it doesnt work :S). The result is not very good I think, because it can collide with the player too.


Thanks for all your help, and sorry for my bad english.

EDIT: Here is the capx, I was changing the var names to English to make them more learnable for you :). Of course, if you see there are thing that can be in a more reliable way, tell me please! Im a totally noob on this jajaja. Thanks.

NOTE: Graphics and everything is only for learning, nothing is like it seems there :).sirLobito2012-03-09 10:44:29
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Mar 09, 2012 10:36 am

It would help us, to help you, if you would post your CAPX
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Mar 09, 2012 10:44 am

[QUOTE=Weishaupt] It would help us, to help you, if you would post your CAPX[/QUOTE]
Thanks, there it is, up in the first post :)
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Mar 09, 2012 10:49 am

ok....now, what exactly is the problem? The NPC should move at a steady beat and bounce of the wall? What should happen if it colides with the player?

Like THIS?Weishaupt2012-03-09 10:59:51
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Mar 09, 2012 10:57 am

The idea is that if the NPC hits the wall, it gets mirrored and turn into the opposite direction.
If it collides with the player, the player bounds a bit in the opposite direction of the collission.

Thats the first idea.
A second option or thing I would like to learn is that if the NPC collisions with the wall, the NPC bounds, and if he collides with the player, both bound in opposite directions.
But I think Id be able to reach this one if I get the first one :).
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Mar 09, 2012 11:01 am

Take a look at this CAPX
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Mar 09, 2012 11:15 am

Oh man, thats pretty simple.
I havent analyzed it at all yet (Im at work) but it looks too much simpler than what I had.

It doesnt work in the same way with a moveable wall with physics, but I think this happens because I have something to fix in the physics of that type of walls.

Do the forces have to be low numbers? I was applying forces too (100 instead), and you gain what I want more or less with a 0.5 value.

Thanks Wieshaupt!
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Mar 09, 2012 12:22 pm

since the force is apply every tick, it does not have to be big. Just play around with the numbers and see what happens....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests