Problem with Pixels lining up.

dotsonj23dotsonj23 Member Posts: 316
edited November -1 in Working with GS (Mac)
In my game, I have certain actors that change their X and Y position based on the position of the actor to their immediate left when. It works about 90% of the time but the other 10% the actor's Y position ends up being 1 pixel off. I know its only 1 pixel but it really makes the game look poorly done when it does that. Due to how my game works, I can't overlap the actors Y by 1 pixel as I do with my X coordinates (which solved the problem with the X coordinates). I believe the GS engine is simply miscalculating or misapplying the Y coordinates by 1 pixel about 1 out of every ten times. Any idea on how to solve this problem. I do have about .5 seconds before everything shows up so my thought was to run a timed check on each result and if it does not equal what it should have the rule run again. But if GS engine is truly miscalculating or misapplying the results it would theoretically have the same issue with the recalculation (but less noticeable b/c would only be about 1 out of 100 (10x10) error rate. Any other potential solutions?

Comments

  • dotsonj23dotsonj23 Member Posts: 316
    I finally resolved this issue and figured I would post the solution in case anyone else is having this problem. I determined that GS is indeed a little off when it comes to displaying pixels. When I compared my two actors (images) in photoshop they would line up perfectly pixel for pixel. But when I put into GS they were exactly 1 pixel off whether I moved one actor up or down by 1 pixel or changed one of their sizes slightly. Even moving .5 Y pixels did not work. Here is the solution. Put the actors in stretch mode. Increase one actors height by 1 from its native. Then for the other actor offset its Y position by -.5 from where it should be if GS actually displayed an images pixels exactly correctly. That solved the problem. This is something that should be fixed.

    FYI ... all my images are divisible by 2 so I know that is not the problem. It appears GS is literally reducing for example a 512 pixel image to 511 and leaving a 1 pixel alpha. Or something like that. Of course if my images were the exact same size 512 and 512 they had no problem lining up but when one is bigger than the other I would get the 1 pixel issue (e.g., 512 and 256). This is a big deal for things like slopes and hills.
  • jb15jb15 Member Posts: 602
    I had that problem last week. Drove me crazy. My solution was to export as a different size in inkscape. Your's is better though--I'll try it next time I have trouble.
Sign In or Register to comment.