obj_tile_furniture_lines.gml
object_create(
"obj_tile_furniture_lines",
undefined,
{
sprite_index: undefined,
create: function() {
valid = false;
line_alpha = 1.0
self.arrow = self.create_renderable();
self.cursors = [];
self.splotches = [];
self.splotch_data = undefined;
//
function setup_render_arrow(render_arrow, top_left_x, top_left_y, bot_right_x, bot_right_y) {
var render_points = furniture_arrow_offset(
render_arrow,
top_left_x,
top_left_y,
bot_right_x,
bot_right_y,
);
self.arrow.animation = render_points[0];
self.arrow.animation_frame = 0;
self.arrow.x = render_points[1];
self.arrow.y = render_points[2];
self.arrow.visible = true;
self.arrow.depth = self.depth;
self.arrow.teleport();
}
function setup_cursor_data(cursor_data) {
//
var tile_spr_to_draw = tile_cursor_sprite_bundle().furniture[self.valid];
for (var i = 0; i < cursor_data.count(); i++) {
if array_length(self.cursors) == i {
array_push(self.cursors, self.create_renderable());
}
var cursor_renderable = self.cursors[i];
var this_data = cursor_data.get(i);
cursor_renderable.animation = tile_spr_to_draw;
cursor_renderable.animation_frame = 0;
cursor_renderable.x = this_data.pos_x + self.x;
cursor_renderable.y = this_data.pos_y + self.y;
cursor_renderable.depth = self.depth;
cursor_renderable.alpha = self.line_alpha;
cursor_renderable.texel_override = [this_data.part_x, this_data.part_y, 8, 8];
cursor_renderable.visible = true;
cursor_renderable.teleport();
}
}
function setup_splotches(splotch_data) {
self.splotch_data = splotch_data;
//
var c;
var blend_mode;
if self.valid {
blend_mode = [bm_src_alpha, bm_one];
c = make_color_rgb(2, 43, 0);
} else {
blend_mode = [bm_dest_color, bm_zero];
c = make_color_rgb(255, 155, 123);
}
for (var i = 0; i < splotch_data.count(); i++) {
if array_length(self.splotches) == i {
array_push(self.splotches, self.create_renderable());
}
var splotch = self.splotches[i];
var splotch_pos = splotch_data.get(i);
splotch.animation = spr_pixel;
splotch.animation_frame = 0;
splotch.tint = c;
splotch.draw_blend_mode = blend_mode;
splotch.x = splotch_pos.x + self.x;
splotch.y = splotch_pos.y + self.y;
splotch.x_scale = 8;
splotch.y_scale = 8;
splotch.depth = self.depth;
splotch.depth_sub_offset = 1;
splotch.visible = true;
splotch.teleport();
}
}
},
step: function() {
self.splotch_data = undefined;
self.arrow.visible = false;
for (var i = 0; i < array_length(self.cursors); i++) {
self.cursors[i].visible = false;
}
for (var i = 0; i < array_length(self.splotches); i++) {
self.splotches[i].visible = false;
}
},
}
);