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

GML Helping to understand an error here?

T

theraje3

Guest
Hi, my error comes when I have set an obj_floor as my ground and walls to collide with. And then I have an obj_tranparentwall that looks exacly the same than the floor but it has no collision with the player.

in my collision sistem I have this:
Code:
if place_meeting(x + hsp,y,obj_floor) {                               
        while !place_meeting(x + sign(hsp),y,obj_floor){               
            x += sign(hsp)                                               
        }
        
            hsp = 0   
    }
    x += hsp
and obj_transparentwall is not child of obj_floor so in theory it shouldt stop the motion. but instead the player move 1 frame and the other dont. so I dont really know why is this "trying to collide".

i find that the error is in that piece of code my modifing it to dodge the obj_transpwall. but that makes more errors so I want to understand why it is trying to collide. thx
 
T

theraje3

Guest
just in case i wasnt clear... first time code runs, it let the player move when inside the obj_tranparentwall but the next time the code runs, it set hsp back to 0 and the next time let it run again so
if 1 = collide and 0 = not colliding hte gameplay is:
01010101010101010101...
 
T

theraje3

Guest
Do you have code anywhere in your player object that would cause hsp to be changed?
that is the last calculation, with the horizontal collision detect and stop if detected. it works with an switch machine. it happens when the player is falling (dosnt matter the previus state), then when i fall into transpwall object that bug happens

update: when im inside the tranpwall after falling i cant move, if i jump and get out of collision and reenter it i can move
 
Last edited by a moderator:
T

theraje3

Guest
im testing everything i can to give you a better explainin of what may the error be so i will keep editing the top post on the news
 
T

theraje3

Guest
looks like only happen 1 time, then it wont happen again after the player reenter the trasp_wall after leavin it 1 time
 
Last edited by a moderator:
T

theraje3

Guest
the game sometimes detect obj_transparentwall like a obj_floor when it shouldnt. thats why it dosnt let me move inside
 
T

theraje3

Guest
okay. Its all about the collision loops etc. must round somehow hsp and vsp


FINAL UPDATE: I was falling into obj_floor trough obj_transparentwall and getting inside it. thats why looks like i have left and right obj_floor. y was 0.50 pixels inside it. so I rounded the final state of movement by:
Code:
y += round(vsp)
x += round(hsp)
WARNING!

if u have this:
Code:
y += min(vsp,max_vsp)
wont work rounding it..
 
Last edited by a moderator:
Top