Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Check for surrounding objects
- var xx, yy, obj, check, terrain;
- terrain = argument0;
- obj = argument1;
- xx = argument2;
- yy = argument3;
- check = 0;
- //This is the checking
- if !instance_position(xx+20,yy,obj) {check += 2;}
- if !instance_position(xx,yy-20,obj) {check += 4;}
- if !instance_position(xx-20,yy,obj) {check += 8;}
- if !instance_position(xx,yy+20,obj) {check += 16;}
- //Now check diagonally
- if check = 0 {
- if !instance_position(xx+20,yy-20,obj) {check += 32;} else
- if !instance_position(xx-20,yy-20,obj) {check += 64;} else
- if !instance_position(xx-20,yy+20,obj) {check += 128;} else
- if !instance_position(xx+20,yy+20,obj) {check += 256;}
- }
- //Generate tile accordingly
- execute_string(global.t_add[check],terrain,xx,yy);
Advertisement
Add Comment
Please, Sign In to add comment