Can't invert the "On Collision with Sprite" condition.

Bugs will be moved here once resolved.

Post » Fri Nov 07, 2014 9:33 am

Problem Description
Can't invert the "On Collision with Sprite" condition.

Attach a Capx
https://dl.dropboxusercontent.com/u/6074572/runner.capx

Description of Capx
If Sprite4 (green sprite) collides with an enemy, it can fall behind until it goes off the screen. However, I want it to recover once no collisions are made, up until some point (e.g. run faster than the camera, thus positioning itself towards the center of the screen). Try standing on an enemy's head to fall behind.

Steps to Reproduce Bug
  • Stand on enemy head to fall behind a bit.
  • Jump off his head to gain speed.
  • Issue is, it gains speed even when it's on the enemy's head, I want it to gain speed only when his not in collision with any enemies...

Observed Result
I can't invert the "On Collision with Sprite" to "On Not Collision with Sprite"

Expected Result
"On Not Collision with Sprite" should be available

Affected Browsers
  • Chrome: YES
  • FireFox: YES
  • Internet Explorer: YES

Operating System and Service Pack
Windows 8.1 Pro

Construct 2 Version ID
R185 64Bit
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Fri Nov 07, 2014 9:53 am

triggers can not be inverted, since they just happen outside thé normal events timeline (an inverted trigger would basically run constantly, like a inninterupted while loop, which you do not want)

try to use the is overllaping instead
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Nov 07, 2014 10:12 am

Thanks Aphrodite, however, how is "is overlapping" any different? when I invert it, doesn't it run constantly as well?
In addition, when I'm on top of the overlapping sprite, the event is not met for some reason... I'm guessing "overlap" means X AND Y overlap?

Also, if I want to perform an action is the position is less then 200 AND isn't overlapping a sprite, I better of putting the X condition first, right?
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Fri Nov 07, 2014 12:16 pm

overlaps and collision are calculated according to the collision mask you define on your sprite.
You should use on collision or trigger once for overlapping to check for collision.
and !overlapping for everything else

you can calculate the distance with the distance expression
distance(obj1.X,obj1.Y,obj2.X,obj2.Y)
Image
B
76
S
28
G
12
Posts: 515
Reputation: 12,409

Post » Wed Nov 12, 2014 1:45 pm

Closing as by design. I'm not sure how the engine ought to handle a trigger that says "On not colliding with a sprite" anyway. I think what you're after is just the first tick of an inverted 'is overlapping' condition.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 12 guests