Quick question on coordinates

Get help using Construct 2

Post » Thu Dec 01, 2011 8:36 pm

So I have two sprites of the same height.
I've added the event Sprite1 on collision with Sprite2 and the sub-event Sprite1 Y = Sprite2 Y.
The action is Destroy Sprite2.

Shouldn't walking with Sprite1 into Sprite2 on the same platform (same height) trigger the event?

Example:
http://dl.dropbox.com/u/35440583/Height_Test/Height_Test.capxKFC2011-12-01 20:36:42
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Thu Dec 01, 2011 8:54 pm

Debug the values of sprite.y and sprite2.y
You would see that sprite ends at 311 and sprite2 at 312.

The comparison is never true, hence the destroy action never executed.
Height_test_more
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Dec 01, 2011 9:07 pm

Thanks.


It would be nice if it was constant at 311, but 1 in every 10 jumps sprite.y stops somewhere in between 311 and 312, adding up to 4 decimals.

I guess it can't be helped.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Thu Dec 01, 2011 9:14 pm

I guess the "Pixel rounding" project property can help if set to on.Kyatric2011-12-01 21:15:30
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Dec 01, 2011 9:27 pm

Actually the 1 pixel difference was most likely caused because I forgot to edit the collision polygon for the sprites.

Pixel rounding didn't seem to help much, but it is funny how they both always spawn at the same position, even if it is at 311.1045.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, Matthew de, Skebab, spcsmrf and 6 guests