GMS 2 path_assign(mypath,path) not functioning, help please anyone?

F

Falconsoft-Industries

Guest
Obj_jack_Oshimatao_prop1:

Create event:
audio_play_sound(mus_music_normal,100,1)
mypath =path_add()
path_assign(mypath,pat_path_required)
path_speed =8
path_completed =0
image_index =0
sprite_index =spr_jack_oshimatao_walking_south_east
image_speed =4
alarm[0]=4

Alarm 0 event:
if direction == 315 and path_completed <1
{
sprite_index=spr_jack_oshimatao_walking_south_east
alarm[0]=4
}
if direction == 45 and path_completed <1
{
sprite_index=spr_jack_oshimatao_walking_north_east
alarm[0]=4
}
if path_completed >0
{
room_goto_next()
}

Path Ended event:
path_speed=0
image_speed=0
image_index=0
sprite_index=spr_jack_oshimatao_north_east
path_completed=1

What am I doing wrong here?
 
Seeing as you aren't really telling us what is happening, I am just going to have to guess.
Try putting
Code:
show_debug_message("direction: " + string(direction));
as the very first line in your Alarm[0] event and see what it says is the direction.
I am just guessing that the direction is neither 315 or 45, so therefore the alarm basically does nothing.

Perhaps you can also elaborate on what is happening/not happening?
 
F

Falconsoft-Industries

Guest
Okay well that’s all in the alarm event working, now the problem is that the prop does not move on the path and follow the path everything else works fine.
 
F

Falconsoft-Industries

Guest
Where do you call path_start?
You know I think I completely forgot to add that line of code, is it easy to understand or how complicated is it?, because I have never needed it before.
You see I never needed to use paths up until now, in the past I would rely on collisions with objects and direction variables and speed and trigger objects that would have image_alpha set to 0 in their create events.
 
is it easy to understand or how complicated is it?
Did you click the link? It take you to the online docs, where it gives examples of how to use the path_start function. It's easy to use if you read the doc.
If this helps:
Code:
path_start(path, speed, endaction, absolute);
path = The path index to start.
speed = The speed of which to follow the path in pixels per step, negative meaning going backwards.
endaction = What to do when the end of the path is reached (see the constants for endaction listed below).
absolute = Whether the calling instance should follow the absolute path as it is in the editor (true) or a relative path to its current position (false).

endaction:
path_action_stop = End the path
path_action_restart = Continue the path from the start, jumping to the start position again if the path is not closed
path_action_continue = Continue from the current position
path_action_reverse = Go backwards along the path again (achieved by reversing the path movement speed)

Give it a try and then if there are any problems let us know what is/is not happening so we can then help you out further?
 
F

Falconsoft-Industries

Guest
Thanks that really helps me out. :)
Edit: yes thank you soo much you have solved my cutscene problem...
 
Last edited by a moderator:
Top