Collision help

S

Somtam

Guest
Hi, Ive set up movement and need help with collision at a wall.
Im new to this and would appreciate the help, thanks!
the error im getting is: "In Script scr_player_step at line 59 : malformed if statement"

Im trying to use place_meeting to detect when the player touches a wall and set movement to 0.

Here is my Input Create event:

var scr = "[obj_ctrl_Input]: ";
// Usage in debugging:
// show_debug_message(scr+"script active...");

// settings ----------------------------------------------------------
button_up = ord('W');
button_down = ord('S');
button_left = ord('A');
button_right = ord('D');
button_end = vk_escape;



// flags -------------------------------------------------------------
do_init = true;
do_destroy = false;
destroy_silent = true;

is_down = false;
is_up = false;
is_left = false;
is_right = false;




// process variables -------------------------------------------------



// -- delta time
delta_expect = (1000000 / room_speed); // microseconds
delta = 0; // ratio of expected fps vs. actual fps


Here is my Input step event


Here is my player create event:
var scr = "[obj_player]: ";
// Usage in debugging:
// show_debug_message(scr+"script active...");

// settings ----------------------------------------------------------

subimage_default = spr_player;
alpha_default = 1.0

scale_x_default = 1
scale_y_default = 1
direction_default = DIR.right

step_length_default = 3
health_max = 100




// flags -------------------------------------------------------------
do_init = true;
do_destroy = false;
destroy_silent = true;




// process variables -------------------------------------------------
visible = false;

subimage_current = -1
scale_x_current = -1
scale_y_current = -1
direction_current = -1

step_length_current = -1
health_start = -1
input = -1


// -- delta time
delta_expect = (1000000 / room_speed); // microseconds
delta = 0; // ratio of expected fps vs. actual fps


and this is the player step event:

// on initialization ------------------------------------------------
if (do_init)
{

input = global.input


subimage_current = subimage_default
scale_x_current = scale_x_default;
scale_y_current = scale_y_default;
direction_current = direction_default;

step_length_current = step_length_default
health_start = health_max


visible = true;

do_init = false;
} // end of do_init

// on request -------------------------------------------------------

if (do_destroy && destroy_silent)
{
instance_destroy();
do_destroy = false;
} // end of do_destroy

// on every step ----------------------------------------------------

// delta time -----------------------
delta = delta_expect / delta_time;
// ----------------------------------

// player movement
if (input.is_right)
{
x += step_length_current
}
else if (input.is_left)
{
x -= step_length_current
}

if (input.is_up)
{
y -= step_length_current
}
else if (input.is_down)
{
y += step_length_current
}
//< giving me an error here????
if place_meeting(x,y, obj_wall);
{
step_length_current = 0;
}
 
Top