Object's Y detection failure

Bugs will be moved here once resolved.

Post » Thu Jun 12, 2014 11:33 pm

Problem Description
Does not properly detects an object's Y.

Attach a Capx
https://db.tt/K5m2C91E

Description of Capx
It's a scrolling game. There are 4 colors tiles randomly generated from 4 instances of a spawner.
I needed a trigger for the spawners to generate the tiles. So i choosed: when the blue tile's Y=768 then generate 4 tiles on the spawner's position.

I used 192/256 grid snapping.

There is a variable controlling the speed of the tiles. The default is 8 pixels per tick so it works because 8 is a multiple of 768. The tile jumps per 8 pixels every tick.

But the problem comes when I set speed to 9 and Y trigger to 774 (because 9 is a multiple of 774)
It does not spawn the tiles. I think Construct 2 is not detecting collision between the blue tile and the 774 Y.

NB: Check here for the different multiples http://www.calculatorsoup.com/calculato ... tiples.php

Steps to Reproduce Bug
    Open the CapX
    Run to see how it works
    Now change the global variable "Speed" to 9
    And change the Y detection to 774
    Image



Observed Result
Tiles don't spawn.

Expected Result
Tiles should spawn. This is the big problem, for seemless spawning i will just offset their spawn with imagepoints.

Affected Browsers
    All of them

Operating System and Service Pack
Windows 7

Construct 2 Version ID
r 171
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Fri Jun 13, 2014 3:23 am

I did not look at your capx. but, why don't you create a line with an invisible sprite. Just draw it out. Set the sprite at Y 768. Use on collision with the sprite to trigger spawning. Doesn't matter what speed tile is moving.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Fri Jun 13, 2014 9:39 am

Because the collision is imperfect. I've already tried this. Only the exact Y is perfect. It must be pixel precise.
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Fri Jun 13, 2014 10:09 am

You're spawning the objects at -256 though, not 0. 774 + 256 isn't a multiple of 9.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Fri Jun 13, 2014 11:03 am

-_- true.. I will test this out with the new values and will return to say if the problem is fixed or not.
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Fri Jun 13, 2014 2:37 pm

Sorry it does not work :(

I've choosen 770 value for Y because 770+256=1026 and it's a multiple of 9.

Some strange stuff though.
first
The Y seems to be detected sometimes sometimes nope. The tiles don't spawn seamlessly.

second
And because 770 has 2 pixels offset with 768 which corresponds to the grid snapping I've put the spawn image point y+2 to compensate the 2 pixels difference. Well when I do this it does not spawn at all. Wtf?

Here is the updated capx with the bug by the way https://db.tt/wPB88NMW
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Sat Jun 14, 2014 7:54 pm

up :(
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Sun Jun 15, 2014 6:10 pm

Try instead of doing a check for "Y = 744", doing two checks for the grid positions after and before (so if Y > 744-gridsize, and Y < 744+gridsize).

Even though it snaps to grid visibly, maybe it isn't doing a pixel-perfect snap each tick (Also, a tick isn't guaranteed to be exactly 60x a second, but I'm not sure how that affects the grid snapping)
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,204
Reputation: 19,545

Post » Sun Jun 15, 2014 10:05 pm

It's not the problem.
The problem is Construct 2 is not precise enough.
I still have gaps between tiles
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Sun Jun 15, 2014 10:25 pm

@Ashley

We can close this topic.
I realize I can't ask C2 to be pixel perfect.

The problem came from a delay between spawning the sprite and actually moving it. I accepted the fact that C2 can't handly such quick operations milliseconds perfect so I've come up with alternative solutions.

For those who might want to know. I just precreate 3 ranks of tiles and each time that for instance 3 blue collide with the sprite trigger i put those 3 new sprites in movement and immediately create 3 other sprites outside the layout ready to move.

For moving C2 does it very well.
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests

cron