C
Chill
Guest
So the next mechanic im trying to wrap my head around is a hookshot/grapple mechanic, trying to find a decent video on youtube has been difficult, figured i would try to see if someone has set something up like this before,
right now my code is this for key im using for it, ive created a 1X1 pixel for creating the rope, and thats pretty much what ive got so far.
What i'd like it to do is attach only to certain objects or grapple points that are a certain distance away i'm thinking about 75 pixels, otherwise it will just draw the grapple line and fall or curl up, i also want to use the grapple to grab items, and will be using it in a boss fight to pull a mask off. The project is not for any commercial use, and is for a Game Development class, any help with the mechanic would be appreciated greatly as my team members are not much help.
if (gkey) {
switch (itemSelected){
case 1: //torch
if (place_meeting(x,y, obj_large_torch)){
obj_large_torch.activate = true;
}
else {
if (!instance_exists(obj_light_player)){
instance_create(obj_player.x,obj_player.y, obj_light_player);
}
else
{
with(obj_light_player) {
instance_destroy();
}
}
}
break;
case 2: //grapple
break;
case 3: //crossbow
if (ammo > 0) {
if (!shot) {
instance_create(x,y,obj_arrow);
shot = true;
ammo -= 1;
alarm[1] = 10;
}
}
break;
}
}
right now my code is this for key im using for it, ive created a 1X1 pixel for creating the rope, and thats pretty much what ive got so far.
What i'd like it to do is attach only to certain objects or grapple points that are a certain distance away i'm thinking about 75 pixels, otherwise it will just draw the grapple line and fall or curl up, i also want to use the grapple to grab items, and will be using it in a boss fight to pull a mask off. The project is not for any commercial use, and is for a Game Development class, any help with the mechanic would be appreciated greatly as my team members are not much help.
if (gkey) {
switch (itemSelected){
case 1: //torch
if (place_meeting(x,y, obj_large_torch)){
obj_large_torch.activate = true;
}
else {
if (!instance_exists(obj_light_player)){
instance_create(obj_player.x,obj_player.y, obj_light_player);
}
else
{
with(obj_light_player) {
instance_destroy();
}
}
}
break;
case 2: //grapple
break;
case 3: //crossbow
if (ammo > 0) {
if (!shot) {
instance_create(x,y,obj_arrow);
shot = true;
ammo -= 1;
alarm[1] = 10;
}
}
break;
}
}