A
AkjoHD
Guest
Hello, everybody.
I have a question in Game Maker Studio 1.4. I am still a beginner and need help with a Point and Click Adventure.
Right now I have:
a player who is controllable with Point and Click
a Pathfinder AI using a grid
a collectable object (still without functions and inventory)
Problem:
When I click on a wall in the game, the player is ported to 0, 0. He can then continue to run normally.
I would like to:
that the player stops on the spot when you click on a wall.
------------------------------------------------------------------------------------------------------------------------------------------------
Here are some codes:
Player Step:
Object Step:
MouseClick Step:
MouseClick GlobalLeftPressed
I have a question in Game Maker Studio 1.4. I am still a beginner and need help with a Point and Click Adventure.
Right now I have:
a player who is controllable with Point and Click
a Pathfinder AI using a grid
a collectable object (still without functions and inventory)
Problem:
When I click on a wall in the game, the player is ported to 0, 0. He can then continue to run normally.
I would like to:
that the player stops on the spot when you click on a wall.
------------------------------------------------------------------------------------------------------------------------------------------------
Here are some codes:
Player Step:
Code:
mouseDistance = point_distance(x, y, obj_mouseClick.x, obj_mouseClick.y)
var grid = mp_grid_create(0, 0, room_width/32, room_height/32, 32, 32)
var path = path_add()
mp_grid_add_instances(path, obj_wall, 0)
mp_grid_path(grid, path, x, y, obj_mouseClick.x, obj_mouseClick.y, 1)
path_start(path, min(4, mouseDistance), "", 1)
if instance_exists(obj_object)
{
if collision_circle(obj_object.x, obj_object.y, 50, obj_player, false, false)
{
if global.mouseCheck = true
{
global.tookobject = true
with(obj_objectinfo)
{
instance_destroy()
}
with(obj_object)
{
instance_destroy()
}
}
}
}
if position_meeting(mouse_x, mouse_y, obj_wall) && mouse_check_button_released(mb_left)
{
x = obj_player.x
y = obj_player.y
}
Code:
if position_meeting(mouse_x, mouse_y, obj_object)
{
global.drawinfo = true
}
if !position_meeting(mouse_x, mouse_y, obj_object)
{
global.drawinfo = false
}
if position_meeting(mouse_x, mouse_y, obj_object) && mouse_check_button_released(mb_left)
{
global.mouseCheck = true
}
if !position_meeting(mouse_x, mouse_y, obj_object) && mouse_check_button_released(mb_left)
{
global.mouseCheck = false
}
Code:
if global.tookobject = true
{
x = obj_player.x
y = obj_player.y
global.tookobject = false
}
Code:
x = mouse_x
y = mouse_y