3D FPS Boss
#1
Posted 23 May 2012 - 05:38 PM
#2
Posted 23 May 2012 - 05:39 PM
#3
Posted 23 May 2012 - 06:25 PM
My solution almost seems too easy to work. In the create event for your boss, set a var called num_hits and set it to 5. Then in the step event, put a check var if num_hits = 0And a note, I wasn't sure whether to post this in the 3D forum, or this one, as it deals with coding that I am not familiar with, so I apologize if it's in the wrong forum.
change instance to dead boss. In the colision event for whatever hits the boss, put boss_obj.num_hits = -1 and check the relative box.
Let me know if this works please.
#4
Posted 23 May 2012 - 06:33 PM
My solution almost seems too easy to work. In the create event for your boss, set a var called num_hits and set it to 5. Then in the step event, put a check var if num_hits = 0
And a note, I wasn't sure whether to post this in the 3D forum, or this one, as it deals with coding that I am not familiar with, so I apologize if it's in the wrong forum.
change instance to dead boss. In the colision event for whatever hits the boss, put boss_obj.num_hits = -1 and check the relative box.
Let me know if this works please.
Just a heads up, if you put 3d in your topic title and put it in the intermediate/Advanced section some people get intimidated by "3d" and may not even read your post reguardless of weather or not they can help. Usually if a person hasn't done 3d before they won't bother to read it unless they are trying to learn something. You probably already knew that, but I'm just saying.
#5
Posted 23 May 2012 - 06:40 PM
#6
Posted 24 May 2012 - 06:09 PM
{
// check whether you can shoot
if (not can_shoot) exit;
can_shoot = false;
// show the animation and play the sound
image_speed = 0.4;
image_index = 0;
sound_play(snd_shot);
// determine what you hit
var xx, yy, ii;
xx = global.camx;
yy = global.camy;
repeat (50)
{
xx += 4*global.camcos;
yy -= 4*global.camsin;
ii = instance_position(xx,yy,obj_wall_basic);
if (ii == noone)
{
ii = instance_position(xx,yy,obj_monster_basic);
if (ii == noone) continue;
with (ii) instance_destroy();
break;
}
if object_is_ancestor(ii.object_index,obj_plant_basic) continue;
if (ii.object_index == obj_barrel) || (ii.object_index == obj_door)
with (ii) instance_destroy();
break;
}
}
#7
Posted 24 May 2012 - 06:18 PM
Here's the code for my gun object, which checks what I hit and reacts accordingly. I'm not sure how I would input the events involving the boss. On first tests, your solution didn't work, but that could be an error on my part in entering it in.
{ // check whether you can shoot if (not can_shoot) exit; can_shoot = false; // show the animation and play the sound image_speed = 0.4; image_index = 0; sound_play(snd_shot); // determine what you hit var xx, yy, ii; xx = global.camx; yy = global.camy; repeat (50) { xx += 4*global.camcos; yy -= 4*global.camsin; ii = instance_position(xx,yy,obj_wall_basic); if (ii == noone) { ii = instance_position(xx,yy,obj_monster_basic); if (ii == noone) continue; with (ii) instance_destroy(); break; } if object_is_ancestor(ii.object_index,obj_plant_basic) continue; if (ii.object_index == obj_barrel) || (ii.object_index == obj_door) with (ii) instance_destroy(); break; } }
Another way to do it would be to give the boss his own healthbar, doesn't matter if you already have one. You don't even have to show it if you don't want to. Set 2 vars in the create event for your boss. global.boss_health and global.boss_max_health. Use those vars as the values for the min and max health when giving your boss the health bar, note that the healhbars work on percent and cant go above 100. put global.boss_max_health var to 100, put global.boss_health at 100, whenever the boss is hit set global.boss_health to -20 (relative) then in the step event put check var if global.boss_health = 0 destroy_instance(boss_obj).
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











