Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define init
- global.offset = 100;
- global.lasthitenemy = 0;
- global.hoverId = 0;
- #define draw
- with(Player){
- var _things = [prop, enemy];
- for(var i = 0; i < array_length_1d(_things); i += 1) {
- with(instances_matching(_things[i],"id",global.hoverId)) {
- if (my_health > 0) {
- if(maxhealth/2 > 100){
- var dx = 100;
- }else dx = maxhealth/2;
- draw_healthbar(x-dx, y-1, x+dx, y+2, (my_health / maxhealth) * 100, c_black, c_red, c_lime, 0, true, true)
- draw_text(x,y,string(my_health)+"/"+string(maxhealth));
- }
- }
- }
- }
- #define draw_gui
- with(Player){
- var _things = [prop, enemy];
- for(var i = 0; i < array_length_1d(_things); i += 1) {
- with(instances_matching(_things[i],"id",global.hoverId)) {
- if (my_health > 0 && "_name" in self) {
- draw_set_colour(c_black);
- draw_roundrect(250, -1+global.offset, 319, 70+global.offset, 0);
- draw_set_colour(c_white);
- draw_roundrect(252, 1+global.offset, 317, 68+global.offset, 0);
- draw_healthbar(253, 50+global.offset, 317, 68+global.offset, (my_health / maxhealth) * global.offset, c_black, c_red, c_lime, 0, true, false);
- //draw_set_font(-1);
- draw_text_transformed(286,6+global.offset,string_upper(_name),0.75,0.75,0);
- draw_set_colour(c_black);
- draw_text(286,56+global.offset,string(my_health)+"/"+string(maxhealth));
- draw_text_transformed(285,5+global.offset,string_upper(_name),0.75,0.75,0);
- draw_set_colour(c_white);
- draw_text(285,55+global.offset,string(my_health)+"/"+string(maxhealth));
- draw_sprite_stretched(sprite_index, -1, 270, 15+global.offset, sprite_width / (sprite_width/30), sprite_height / (sprite_height/30));
- draw_set_colour(c_black);
- draw_rectangle(270,15+global.offset,300,45+global.offset,1);
- }
- }
- }
- }
- #define step
- with(enemy){
- if (x > view_xview && x < view_xview + game_width) && (y > view_yview && y < view_yview + game_height){
- drawme = 1
- }else drawme = 0;
- }
- with(prop){
- if (x > view_xview && x < view_xview + game_width) && (y > view_yview && y < view_yview + game_height){
- drawme = 1
- }else drawme = 0;
- }
- with(enemy){
- if "_name" not in self{
- var _nombre = object_get_name(object_index);
- // Specific aliases for enemies.
- // Read through the list and you'll understand why they're needed
- switch(_nombre){
- case "EnemyHorror": _name = "Horror";break;
- case "BanditBoss": _name = "Big Bandit";break;
- case "Nothing": _name = "Throne"; break;
- case "Nothing2": _name = "Throne 2"; break;
- case "MeleeBandit": _name = "Assassin"; break;
- case "Exploder": _name = "Frog"; break;
- case "SuperFrog": _name = "Fetid Frog"; break;
- case "FastRat": _name = "Fetid Rat"; break;
- case "Ratking": _name = "King Rat"; break;
- case "BuffGator": _name = "Buff Gator"; break;
- case "FrogQueen": _name = "Ballmum"; break;
- case "SnowBotCar": _name = "SnowBot"; break;
- case "Last": _name = "IDPD Captain"; break;
- default: _name = _nombre; break;
- }
- // Streamlined replacement of parts of an enemy's name
- // This mostly applies to things later in the game (Elites, Crystals, etc)
- _name = string_replace_all(_name,"Inv","Cursed ");
- _name = string_replace_all(_name,"Gold","Golden ");
- _name = string_replace_all(_name,"Elite","Elite ");
- _name = string_replace_all(_name,"Crystal"," Crystal");
- _name = string_replace_all(_name,"ScrapBoss","Big Dog ");
- _name = string_replace_all(_name,"Jungle","Jungle ");
- _name = string_replace_all(_name,"Maggot"," Maggot");
- // Cleanup. Deletes spaces at the beginning and end of the names.
- if string_char_at(_name,1) = " "{
- _name = string_delete(_name,1,1);
- }
- if string_char_at(_name,string_length(_name)) = " "{
- _name = string_delete(_name,string_length(_name),1);
- }
- // For debugging purposes, we display their object names and aliases in chat
- //trace(_nombre,'==>','"' + _name + '"',);
- }
- }
- with(prop){
- if "_name" not in self{
- var _nombre = object_get_name(object_index);
- // Specific aliases for props.
- // Read through the list and you'll understand why they're needed
- switch(_nombre){
- case "CarVenus2": _name = "YV's Car";break;
- case "RadMaggotChest": _name = "Rad MaggotChest";break;
- case "MeleeFake": _name = "Faking Assassin";break;
- case "CarVenus": _name = "YV's Car";break;
- case "CarVenusFixed": _name = "YV's Car";break;
- case "GeneratorInactive": _name = "IdleGenerator";break;
- case "NothingInactive": _name = "Throne";break;
- case "BecomeScrapBoss": _name = "Big Dog";break;
- case "NothingIntroMask": _name = "Throne"; break;
- default: _name = _nombre; break;
- }
- // Streamlined replacement of parts of an enemy's name
- // This mostly applies to things later in the game (Elites, Crystals, etc)
- _name = string_replace_all(_name,"Barrel"," Barrel");
- _name = string_replace_all(_name,"Generator"," Generator");
- _name = string_replace_all(_name,"Statue"," Statue");
- _name = string_replace_all(_name,"Mine"," Mine");
- _name = string_replace_all(_name,"Flower"," Flower");
- _name = string_replace_all(_name,"Plant"," Plant");
- _name = string_replace_all(_name,"Pot"," Pot");
- _name = string_replace_all(_name,"Pile"," Pile");
- _name = string_replace_all(_name,"Night","");
- _name = string_replace_all(_name,"TV"," TV");
- _name = string_replace_all(_name,"Crystal"," Crystal");
- _name = string_replace_all(_name,"Tube"," Tube");
- _name = string_replace_all(_name,"Box"," Box");
- _name = string_replace_all(_name,"Skull"," Skull");
- _name = string_replace_all(_name,"Machine"," Machine");
- _name = string_replace_all(_name,"Light"," Light");
- _name = string_replace_all(_name,"Egg"," Egg");
- _name = string_replace_all(_name,"Couch"," Couch");
- _name = string_replace_all(_name,"Chest"," Chest");
- // Cleanup. Deletes spaces at the beginning and end of the names.
- if string_char_at(_name,1) = " "{
- _name = string_delete(_name,1,1);
- }
- if string_char_at(_name,string_length(_name)) = " "{
- _name = string_delete(_name,string_length(_name),1);
- }
- // For debugging purposes, we display their object names and aliases in chat
- //trace("P: ",_nombre,'==>','"' + _name + '"',);
- }
- }
- with instances_matching(projectile,"team",2){
- script_bind_step(trackenemy,1,self,x,y)
- }
- with (enemy){
- if id = global.hoverId{
- image_blend = c_red
- }
- else image_blend = c_white
- }
- with (prop){
- if id = global.hoverId{
- image_blend = c_red
- }
- else image_blend = c_white
- }
- #define trackenemy
- ed = 100000;
- pd = 100000;
- with instance_nearest(argument1,argument2,enemy) if distance_to_point(argument1,argument2) < game_height{
- var ed = point_distance(argument1, argument2, x, y);
- var ei = id;
- }
- with instance_nearest(argument1,argument2,prop) if distance_to_point(argument1,argument2) < game_height {
- pd = game_height;
- var pi = id;
- if(maxhealth > 2){
- var pd = point_distance(argument1, argument2, x, y);
- var pi = id;
- }
- }
- if(pi > 0 || ei> 0){
- if(pd < ed){
- global.hoverId = pi;
- }else global.hoverId = ei;
- }
- instance_destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement