• 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 [SOLVED]Dont Know how to solve this compiling error

B

Ben26

Guest
i was editing my levels or room just moving objects and tiles
and when i tried to play the level i got this message
ddddddd.png
and it's weird because i don't remember messing with the player code so i really don't know where to look for a solution
Code:
Step Event
if (place_meeting(x+hsp,y,obj_wall))
{
while(!place_meeting(x+sign(hsp),y,obj_wall))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;
 
B

Ben26

Guest
Yes, but i think the problem its not in the code i guess..
because i been using it for months without problem and if i remove the horizontal collision code and try to compile it works so i really dont know what its happening

Code:
Step Event:

//PLAYER INPUT

key_right = keyboard_check(vk_right) || (gamepad_axis_value(0,gp_axislh) > 0);
key_left = -(keyboard_check(vk_left) || (gamepad_axis_value(0,gp_axislh) < 0));
key_jump = keyboard_check_pressed(ord('Z'))|| (gamepad_button_check_pressed(0,gp_face1));
key_up = keyboard_check(vk_up) || (gamepad_axis_value(0,gp_axislv) < 0);
key_down = keyboard_check(vk_down) || (gamepad_axis_value(0,gp_axislv) > 0);

//MOVEMENT

move = key_left + key_right;
hsp = move * movespeed;

//JUMPING
if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_wall))
{
vsp = key_jump * -jumpspeed
}

//CROUCHING
if (key_down) and (place_meeting(x,y+1,obj_wall))
{
  sprite_index = spr_pcrouch
  hsp = 0
    } else sprite_index = spr_player

//HORIZONTAL COLLISION

if (place_meeting(x+hsp,y,obj_wall))
{
while(!place_meeting(x+sign(hsp),y,obj_wall))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;

//VERTICAL COLLISION
if (place_meeting(x,y+vsp,obj_wall))
{
    while(!place_meeting(x,y+sign(vsp),obj_wall))
    {
        y += sign(vsp);
    }
    vsp = 0;
}
y += vsp;
  

//MAX & MIN HP

if global.hp < 0
{
global.hp = 0;
}

if global.hp > 6
{
global.hp = 6;
}

//DYING

if global.hp <= 0
{
instance_destroy();
room_restart()
}
 

Ido-f

Member
Maybe you have assigned x to a macro somewhere? Another option is to restart everything and make sure you have the updated version and such...
 
Top