Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

place_meeting on Polygon mode checks using instance's current place and not expected place #2298

Open
HitCoder9768 opened this issue May 30, 2022 · 0 comments

Comments

@HitCoder9768
Copy link
Contributor

HitCoder9768 commented May 30, 2022

Describe the bug

when using place_meeting the arguments supplied are X, Y and object to check collisions with.
The object calling place_meeting will use it's own bounding box to check collisions.
Currently supplying X and Y does not offset the position the collision is checked, meaning objects will get stuck inside of other objects

Steps To Reproduce

some sample code that can be used on an object to check this bug

/// ===== CREATE EVENT ========= ///
/// initialisation and vars
spd=6; //max speed
acc=1; //acceleration
vel=0; //current velocity

/// ===== STEP EVENT ============ ///
/// movement
// check keys pressed and accelerate, otherwise decellerate
if(!(keyboard_check(vk_left) || keyboard_check(vk_right) || keyboard_check(vk_up) || keyboard_check(vk_down))){
    vel=max(vel-acc,0);
}else{
    vel=min(vel+acc,spd);
}
/// collisions
// change position of object based on velocity values
if(!place_meeting(x+cos(degtorad(direction))*(vel+1),y-sin(degtorad(direction))*(vel+1),objWall)){
    x+=cos(degtorad(direction))*vel;
    y-=sin(degtorad(direction))*vel;
}

/// ===== ANY KEY EVENT =========== ///
//movement
// check button pressed and set the direction value accordingly
if(keyboard_check(vk_left)){
    AnimCurrent=AnimWalkLeft;
    // Diagonal movement
    if(keyboard_check(vk_up))
        direction = 135;
    else if(keyboard_check(vk_down))
        direction = 225;
    else
    // normal movement
        direction = 180;
}else if(keyboard_check(vk_right)){
    AnimCurrent=AnimWalkRight;
    // Diagonal movement
    if(keyboard_check(vk_up))
        direction = 45;
    else if(keyboard_check(vk_down))
        direction = 315;
    else
    // normal movement
        direction = 0;
}else

if(keyboard_check(vk_up)){
    AnimCurrent=AnimWalkUp;
    direction = 90;
}else
if(keyboard_check(vk_down)){
    AnimCurrent=AnimWalkDown;
    direction = 270;
}

Expected behavior

place_meeting should check a collision at the supplied coordinates and not the calling object's coordinates.

Game files & Screenshots

The following project is a port of a project i made in GMS2 for school in 2017 to enigma
College_game.gmx.tar.gz

ENIGMA Configuration:

  • Endeavour OS (Arch, LINUX510)
  • Occurs on Polygon collision engine
@HitCoder9768 HitCoder9768 changed the title place_meeting checks using instance's current place and not expected place place_meeting on Polygon mode checks using instance's current place and not expected place May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant