41
Can anyone give me some good C# tutorials?
//Put this in the step event
if distance_to_object(obj_normal_link)>20
move_towards_point(obj_normal_link.x,obj_normal_link.y,5) //This makes the fairy follow link
if distance_to_object(obj_normal_link)<20
move_towards_point(obj_normal_link.x,obj_normal_link.y,0) //This makes the fairy stop when it gets too close
But when i press the sword it changes to obj_link_with_sword but then i get an error, because there is no obj_normal_link, how could i fix this?
{
if(distance_to_object(obj_normal_link)>0) {
if(keyboard_check(ord('A')) {
alarm[0] =60
} else {
alarm[0] =0
}
} else {
if(distance_to_object(obj_normal_link)<0) {
alarm[0] =0
}
}
{
if(keyboard_check(ord('A')) {
Say("Hello Link",true,true,true)
}
}
if (! file_exists('Player' + string(argument0) + '.mgb')) {
ini_open('Player' + string(argument0) + '.mgb');
if !variable_global_exists("totalhearts") { global.totalhearts=3 }
if !variable_global_exists("hearts") { global.hearts=string(tempHeartContainers) }
}
{
/* Movement Engine if Used Give Credit to Linkthemaster */
/* Move Right */
if(keyboard_check(vk_right)) {
direction=0;
speed=5;
sprite_index = link_right;
}
/* Move Left */
if(keyboard_check(vk_left)) {
direction=180;
speed=5;
sprite_index = link_left;
}
/* Move Down */
if(keyboard_check(vk_down)) {
direction=270;
speed=5;
sprite_index = link_down;
}
/* Move Up */
if(keyboard_check(vk_up)) {
direction=90;
speed=5;
sprite_index = link_up;
}
if(!keyboard_check(vk_left) && !keyboard_check(vk_right) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) {
speed=0;
}
}