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

Windows Error

Neutroo

Member
hi i'm having an error if you can help me this is the error look

ERROR in
action number 1
of Create Event
for object <undefined>:

Variable <unknown_object>.y(1, -2147483648) not set before reading it.
at gml_GlobalScript_move_state (line 27) - if place_meeting(x+hspd,y,obj_parede){
############################################################################################
gml_GlobalScript_move_state (line 27)
help me please
 

Neutroo

Member
//collision horizontal
if place_meeting(x+hspd,y,obj_parede){
while !place_meeting(x+hspd,y,obj_parede){
x +=sign(hspd)
}
hspd=0;
}


//vertical collision
if place_meeting(x, y+vspd,obj_parede) {
while !place_meeting(x,y+vspd,obj_parede){
y +=sign(vspd)
}
vspd=0;
}


this is my collision code that is giving error
 

Neutroo

Member

TsukaYuriko

☄️
Forum Staff
Moderator
The linked topic tells you how to update and even includes pre-2.3 and post-2.3 tables for comparison.

If you're having trouble with this despite that, post what you tried and we'll tell you where you took a wrong turn.
 

chamaeleon

Member
I saw it but I don't know how to update
GML:
function move_state() 
{
    //collision horizontal
    if place_meeting(x+hspd,y,obj_parede){
        while !place_meeting(x+hspd,y,obj_parede){
            x +=sign(hspd)
        }
        hspd=0;
    }


    //vertical collision
    if place_meeting(x, y+vspd,obj_parede) {
        while !place_meeting(x,y+vspd,obj_parede){
            y +=sign(vspd)
        }
        vspd=0;
    } 
}
 
Top