# Randomly rounding down Player.X position

0 favourites
• 4 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
• 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.

• By design the Platform behavior only works to the nearest pixel. Is half a pixel really crucial to your game mechanic?

• 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.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• 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.

• 4 posts