Randomly rounding down Player.X position

Bugs will be moved here once resolved.

Post » Sat Apr 14, 2012 5:18 am

Hello, everyone. I'm trying to make a platform game, and while testing it, I saw that, sometimes, after I jumped, or, on landing, to be more precise, the player would go slightly to the left. After some debuging, here's the breakdown...

If the player has platform behavior and is in a position X that has decimals, if you jump a little bit, the mechanics will round down X to the lower number(100.98 will be 100, 34.234 will be 34 and so on), making the player go a little to the left.

This can be a problem in a game that requires precision jumping, because if the player tries to jump to a platform on his left and doesn't reach it because it jumped to early but manages to hit it, usually he would just need to jump again and press left after the right altitude to get on top of it. But, if the game rounds the X position after the player lands, he'll go slightly to the left and the jump would only make the player hit his head on the platform.

I tried this with my game and the examples, reseted my PC, same results.

http://dl.dropbox.com/u/73222231/rounding%20X.capx

Here's a simple project I used to test this, it's a modified Construct 2 example. I just put a vertical platform and changed the text to correspospond to the player.x position. Use WASD to move around. Just jump hitting the right side of the vertical platform, jump a little more and you'll see that the game rounded down the player X position, and it's now underneath the platform instead of right beside it.

samgamgi2012-04-14 05:20:22
B
7
Posts: 12
Reputation: 800

Post » Sat Apr 14, 2012 11:40 am

By design the Platform behavior only works to the nearest pixel. Is half a pixel really crucial to your game mechanic?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Apr 15, 2012 4:01 am

Oh, not really. I'm just beginning, so I'm experimenting a lot, and this particular thing got into me. But it seems to be always rounding down the position, even in values like xx.9, so is it really always going to the nearest pixel?
Or is it me that didn't understood this "nearest pixel" concept?

Anyway, if this isn't a bug, this became an engine question, so, feel free to change the topic position.


B
7
Posts: 12
Reputation: 800

Post » Sun Apr 15, 2012 6:57 am

about the x thing.. there's other odd thing.. I made a text object and set align to center and hotspot too and selected a webfont with the events.. when I preview the game, the text isn't place exacly where was intended, it is a little to the right.. if I add an action that make the text bigger when selected it back to his correct place.
B
30
S
6
G
5
Posts: 433
Reputation: 6,061


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests

cron