GameMaker [Fixed] Error with tile collision code

D

Dylaniza

Guest
I used a tutorial by GM wolf recently, I don't want to post a link since I don't think you are aloud to, but I keep getting a error that a token is missing. I have done a few checks but can't find the problem, please tell me if you know why this might be happening, and this is an object 'obj_player' Code:

create event:
//basic player varibles
move_speed = 8;
jump_impulse = 21;
grav = 0.75;
v_speed = 0;


//tile map info
var l = layer_get_id("til_collision");
tilemap = layer_tilemap_get_id(l);

//sprite info
sprite_bbox_left = sprite_get_bbox_left(sprite_index) - sprite_get_xoffset(sprite_index);
sprite_bbox_right = sprite_get_bbox_right(sprite_index) - sprite_get_xoffset(sprite_index);
sprite_bbox_bottom = sprite_get_bbox_bottom(sprite_index) - sprite_get_yoffset(sprite_index);
sprite_bbox_top = sprite_get_bbox_top(sprite_index) - sprite_get_yoffset(sprite_index);

Step event:
var dx = move_speed * (keyboard_check(ord('D') - keyboard_check(ord('A')));
var dy = v_speed;
v_speed += grav;

//do verticle move
y += dy;
if( dy > 0) { //downwards
var t1 = tilemap_get_at_pixel(tilemap, bbox_left, bbox_bottom) & tile_index_mask;
var t2 = tilemap_get_at_pixel(tilemap, bbox_right, bbox_bottom) & tile_index_mask;

if(t1 != 0 || t2 != 0) {
((bbox_bottom & ~19) - 1) - sprite_bbox_bottom;
}
} else { //upwards
//not put any code in here yet, since in the tutorial he said you can test it with out to check if it is working.
}

ps, I also commented on his video and he said to check spelling of the layer, but that didn't work.
 
P

PandaPenguin

Guest
so your layer is really named "til_collision" and not..maybe.."tile_collision" ?
other than that it would really help if you could post the error too and put your code into [ CODE] [ /CODE] blocks so it is easier to read
 
D

Dylaniza

Guest
so your layer is really named "til_collision" and not..maybe.."tile_collision" ?
other than that it would really help if you could post the error too and put your code into [ CODE] [ /CODE] blocks so it is easier to read
Thanks for the reply, I use a 3 letter word of the thing it is like spr_ or obj_ but I have had some help fixing it. Thanks again.
 
Top