• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM [SOMEHOW SOLVED]Strange Graphical Distortion?

A

Archival

Guest
I have a strange liitle issue. I have a sidescrolling game and when I bumb the head of my character in the block/collision above me, my character and only my character get a pixel distortion. If I do it again, the pixel distortion disappears?

Something wrong with my "view-center the character- script" ? I

Code:
//Center on player
view_xview=x-view_wview/2-15;
view_yview=y-view_hview/2-15;

//clamp to room
view_xview=clamp(view_xview,0,room_width-view_wview);
view_yview=clamp(view_yview,0,room_height-view_hview);
EDIT: ... Okay the first pic the issue, second one how it should look like, only happens with vertical collision. It affects only! the face
 

Attachments

Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Floor the coordinates so you don't get sub-pixel values.

Code:
view_xview = floor(x - (view_wview / 2)) - 15;
view_yview = floor(y - (view_hview / 2)) - 15;
 
A

Archival

Guest
great -.- i cant create links yet, I need 5 posts, that means no pictures yet....

edit: floor doesn't change anything :/ nor ceil or any other function to round up/down the value....
 
A

Archival

Guest
Ohh, can also upload pictures... Okay the first pic the issue, second one how it should look like, only happens with vertical collision. It affects only! the face
 

Attachments

Nocturne

Friendly Tyrant
Forum Staff
Admin
What's the collision code? Could it be that the instance is constantly being moved from one pixel position to another and so giving this odd effect? Also, what's the base resolution and view port resolution? Lots of times these issues can stem from non-integer scaling problems....
 
A

Archival

Guest
Both port and view resolutions are 320 x 256. I use Pixelated Pope's pixelperfect scaling script... but that isn't the issue, had the same problem before, without pixelperfect scaling. My view_hview is fixed only the horizontal view is dynamic.

thats my vertical collision, horizontal is pretty much the same. Not the first time I have this issue. It's quite strange and only happens if my character bump his head in a vertical placed collision, after a second time, the distortion disappears.... maybe it is actually something wrong with my collison code, I don't know... Also tried to change my collision mask but didn't helped

my native resolution is 1280x1024, I have a 5:4 ratio screen...

Code:
//Vertical Collision
if (place_meeting(x,y+yspeed,obj_Collision))
{
    while(!place_meeting(x,y+sign(yspeed),obj_Collision))
    {
        y +=sign(yspeed);
    }
    yspeed = 0;
}
y +=yspeed;
 
Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Try reformatting that code to simply:

Code:
var _hit = false;
y += yspeed;
while(place_meeting(x, y + sign(yspeed), obj_Collision))
{
y -= sign(yspeed);
hit = true;
}
if _hit yspeed = 0;
 
A

Archival

Guest
Changing the collision doesn't help much. Nothing changed so far... well I guess I go back to high resolution sprites... pixelart seems to be a damn messy thing. Thanks anyways.
 
Last edited by a moderator:
A

Archival

Guest
It was a bug -.- ..changed my code back and the distortion is completly gone cO
 
Top