【GAMEMAKER】 add more sprite or object instance

Information about object: obj_builder
Sprite: spr_road
Solid: false
Visible: true
Depth: -2
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

//
can_build = false;
cursor_x = 0;
cursor_y = 0;
Step Event:
execute code:

var road;
road = obj_road;
//
cursor_x = (mouse_x div 32) << 5;
cursor_y = (mouse_y div 32) << 5;
can_build = (
    place_meeting(cursor_x - 1, cursor_y, road) ||
    place_meeting(cursor_x + 1, cursor_y, road) ||
    place_meeting(cursor_x, cursor_y + 1, road) ||
    place_meeting(cursor_x, cursor_y - 1, road) )
    && !place_meeting(cursor_x, cursor_y, road)
Mouse Event for Glob Left Button:
execute code:

if (can_build)
{
    instance_create(cursor_x, cursor_y, obj_road);
}
Draw Event:
execute code:

var sub;
sub = 0
if (!can_build) sub = 1;
draw_sprite(spr_cursor, sub, cursor_x, cursor_y);

Information about object: obj_road
Sprite: spr_road
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

No comments:

When Bad People Make Good Art

I offer six guidelines on cancel culture ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏...

Contact Form

Name

Email *

Message *