B
BLB
Guest
Hello,
So I am programming a pixel art platformer game in my spare time. I recently started learning GML and GMS. However I have run into an issue with the graphics. Currently while I creating the body of the game like movement, etc I am using a square to simulate my player and enemies.
In the following pictures the Green guy is the player and the pink stuff is the flooring, and walls.
Normally my player would would like this.
You can see that the black lines look really nice and crisp. But when I jump and fall onto the floor I noticed I started getting something like this.
As you can see the bottom line is in the floor slightly. So I thought that this could be caused by my collision detection but before I even went back to the code I noticed this happening sometimes when I hit the floor.
As you can see the top and bottom line are both slim and smaller than the side lines. I though that perhaps it was the Interpolate Color Between Pixels setting. I went into global game settings and changed this for all platforms. I returned to it and I found the same thing happening.
I only have Windows 10 machines (3 to be exact) and this happens on all of them. I thought it may just be my laptop but I get the same thing on my gaming machine with a high end nvidia card.
Here is my code:
In my player create I have
I then have a step event and have the following code there
Does anyone have an idea of what I need to do to fix this or an idea of how to figure out what is going?
Thanks,
BLB
+---------------------------------------RESOLUTION---------------------------------------+
So I am programming a pixel art platformer game in my spare time. I recently started learning GML and GMS. However I have run into an issue with the graphics. Currently while I creating the body of the game like movement, etc I am using a square to simulate my player and enemies.
In the following pictures the Green guy is the player and the pink stuff is the flooring, and walls.
Normally my player would would like this.
You can see that the black lines look really nice and crisp. But when I jump and fall onto the floor I noticed I started getting something like this.
As you can see the bottom line is in the floor slightly. So I thought that this could be caused by my collision detection but before I even went back to the code I noticed this happening sometimes when I hit the floor.
As you can see the top and bottom line are both slim and smaller than the side lines. I though that perhaps it was the Interpolate Color Between Pixels setting. I went into global game settings and changed this for all platforms. I returned to it and I found the same thing happening.
I only have Windows 10 machines (3 to be exact) and this happens on all of them. I thought it may just be my laptop but I get the same thing on my gaming machine with a high end nvidia card.
Here is my code:
In my player create I have
Code:
///Attributes
gForce = 1; // Gravity Force
hsp = 0; // Horizontal Pixel Movement
vsp = 0; // Vertical Pixel Movement
jSpeed = 15; // Jump Speed
mSpeed = 8; // Movement Speed
Code:
///Movement Controls
// +----------------------+
// | Version 1.0 |
// | Last Update |
// | Built Basic Movement |
// +----------------------+
//Get player input
key_right = keyboard_check(vk_right);
key_left = -(keyboard_check(vk_left));
key_jump = keyboard_check_pressed(vk_space);
//-------------------Start of movement algorithm--------------------------------\\
//Calculate left/right movement
move = key_left + key_right; //Ex. (-1) + (0) = -1; (-1) + (1) = 0; (0) + (1) = 1
hsp = move * mSpeed;
//Apply Gravity
if(vsp < 10)
{
vsp += gForce;
}
//Check Jump input
if(place_meeting(x, y + 1, par_wall)) //If place below player is floor
{
//Perform jump
vsp = key_jump * -(jSpeed); //Ex. 1 * -(jump speed)
}
//Horizontal Collision Check
if(place_meeting(x + hsp, y, par_wall)) //Is there something in front of us?
{
//There is, so move as CLOSE to it as possible
while(!place_meeting(x + sign(hsp), y, par_wall))
{
show_debug_message("Collision Detected on X");
x += sign(hsp); //Move one more pixel in current direction
}
//Do not move any further to left or right
hsp = 0;
}
x += hsp;
//Vertical Collision Check
if(place_meeting(x, y + vsp, par_wall)) //Is there something in above or below of us?
{
//There is, so move as CLOSE to it as possible
while(!place_meeting(x, y + sign(vsp), par_wall))
{
show_debug_message("Collision Detected on Y");
y += sign(vsp); //Move one more pixel in current direction
}
//Do not move any further to up or down
vsp = 0;
}
y += vsp;
//-------------------End of movement algorithm-------------------------------------\\
Thanks,
BLB
+---------------------------------------RESOLUTION---------------------------------------+
Issue was that I had a view in my test room that was causing this issue.Normally, rounding your position is supposed to solve such issues. Have you made sure that you round your position after all movement is done and done?
Put "y=round(y);" at the end of your "end step" event or put such event if you haven't. This way you sure its the last thing that happens.
If that doesn't fix the problem, it MIGHT be a scaling issue. What is your view size/port size vs the resolution of the monitor you display your game in? Also, what are your global settings regarding scaling? "keep aspect ratio" or "fullscale" ?
Last edited by a moderator: