How do I use collisions correctly?

Get help using Construct 2

Post » Mon Oct 16, 2017 4:39 pm

Message: farsen can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi!

I´m new to Construct, and have a problem with collisions. I have followed the basic platform tutorial, with an enemy who are colliding with some edge markers (https://www.scirra.com/tutorials/253/ho ... ame/page-7). When this happens, the enemy should be mirrored and the simulate control should go in the opposite direction.
Problem is that the enemy is colliding with the edgemarker multiple times, instead of just one time as it should. And therefore the direction goes left/right the same amount of times. It seems randomly how many times it triggers, but usually two times (which then doesent change the direction).
I´ve been playing around with the speed, acceleration and deceleration which seems to affect the result, but it is not reliable.

So what am I doing wrong? :)

Thanks in advance!
B
4
Posts: 14
Reputation: 232

Post » Mon Oct 16, 2017 5:26 pm

Can you share the capx? If you implemented it exactly how it is in the Tutorial, this shouldn't happen, since it's a "On collision" event, which means it only happens once, when colliding.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Mon Oct 16, 2017 5:30 pm

Message: farsen can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Thanks alot for the fast answer!
You can find the project here: www.larssommer.dk/collision.zip
Take a look at the enemy sprite called 'Pvagt'

Thanks! :)
B
4
Posts: 14
Reputation: 232

Post » Mon Oct 16, 2017 5:41 pm

I'll take a look. Meanwhile, I had already made a capx, so, check it...

https://www.dropbox.com/s/1mnzfh2o9sfe3 ... .capx?dl=0

Cheers.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Mon Oct 16, 2017 5:46 pm

Hey @farsen!

Just so you know... The problem with your code is that you're telling the sprite to mirror and simulate direction press without changing the "action" variable. You should only change the "action" variable, as shown in the image below:

Image

hope this clarifies the issue. Cheers!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026

Post » Mon Oct 16, 2017 6:13 pm

Doh, sorry! Of course!
Thanks alot for helping with my blindness :)
B
4
Posts: 14
Reputation: 232

Post » Mon Oct 16, 2017 6:31 pm

Glad to help! Good luck!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 722
Reputation: 4,026


Return to How do I....?

Who is online

Users browsing this forum: mumu64 and 1 guest