I should have just posted this from the beginning. I'm merging the walls which works perfectly.
// merge walls
var a, merge;
with (obj_poly_block_static1) {
a = instance_create(x-32, y-32, obj_wallbox);
a.w = 64;
a.h = 64;
};
do {
merge = false;
with (obj_wallbox) {
with (obj_wallbox) {
if x = other.x+other.w and y = other.y and h = other.h {
other.w += w;
merge = true;
instance_destroy();
}
}
}
} until (merge = false);
do {
merge = false;
with (obj_wallbox) {
with (obj_wallbox) {
if y = other.y+other.h and x = other.x and w = other.w {
other.h += h;
merge = true;
instance_destroy();
}
}
}
} until (merge = false);
with (obj_wallbox) {
body_id = ep_body_create_static(global.world_id);
shape_id = ep_shape_create_box(global.world_id, body_id, w, h, w/2, h/2, 0, 1);
ep_shape_set_collision(global.world_id, body_id, shape_id, collide1a, collide1b, 0);
ep_shape_set_material(global.world_id, body_id, shape_id, 0.2, 0.6, 0, 0);
physics_object_set(body_id);
};
But I'm trying to check for collision but I can't put the code below because there is no code that initiates body_id in 'obj_wallbox', when I press the jump key nothing happens:
with (obj_wallbox) {
for (s = ep_body_first_shape(global.world_id, body_id); s != 0; s = ep_shape_next(global.world_id, body_id, s)) {
if ep_shape_collision_test_box(global.world_id, body_id, s, 64, 64, x, y+2, 0, -0.1) {
collision_down_box = 1;
};
};
};
if (k_jump) = 1 and (collision_down_box) {
y_vel = -jump_force;
};
Got any ideas on how to fix it?
Edited by Mr.Troid, 12 June 2012 - 02:12 PM.