Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define init
  2. // for level start
  3. global.newLevel = instance_exists(GenCont);
  4. global.hasGenCont = false;
  5.  
  6. // character select button
  7. global.sprMenuButton = sprite_add("sprites/sprRavenSelect.png", 1, 0, 0);
  8. global.sprPortrait = sprite_add("/sprites/sprPortraitRaven.png", 1, 0, 190);
  9.  
  10. // level start init- MUST GO AT END OF INIT
  11. while(true){
  12.     // first chunk here happens at the start of the level, second happens in portal
  13.     if(instance_exists(GenCont)) global.newLevel = 1;
  14.     else if(global.newLevel){
  15.         global.newLevel = 0;
  16.         level_start();
  17.     }
  18.     var hadGenCont = global.hasGenCont;
  19.     global.hasGenCont = instance_exists(GenCont);
  20.     if (!hadGenCont && global.hasGenCont) {
  21.         // nothing yet
  22.     }
  23.     wait 1;
  24. }
  25.  
  26. #define create
  27. // player instance creation of this race
  28. // https://bitbucket.org/YellowAfterlife/nuclearthronetogether/wiki/Scripting/Objects/Player
  29.  
  30. // sprites
  31. spr_idle = sprRavenIdle;
  32. spr_walk = sprRavenWalk;
  33. spr_hurt = sprRavenHurt;
  34. spr_dead = sprRavenDead;
  35. spr_sit1 = sprMutant15GoSit;
  36. spr_sit2 = sprMutant15Sit;
  37.  
  38. // sounds
  39. snd_hurt = sndRavenHit;
  40. snd_dead = sndRavenDie;
  41. snd_wrld = sndRavenScreech;
  42.  
  43. // stats
  44. maxspeed = 4;
  45. team = 2;
  46. maxhealth = 10;
  47. spr_shadow = shd24;
  48. mask_index = mskPlayer;
  49.  
  50. // vars
  51. fly_alarm = 0;  // digging
  52. cooldown = 10;  // cooldown til you can fly again
  53. coords = [0, 0];    // fly destination
  54. fly_index = 0;  // image index for fly
  55. spr_fly = sprRavenFly;  // current flight sprite
  56. tempView = -4;  // temp view for player flying- avoid player interacting with pickups and lingering effects
  57. tempView_array = -4;    // array that manages temp views
  58. can_fly = 0;    // disallow flight
  59. died = 0;   // disallow extra frames after death
  60. melee = 0;  // can melee or not
  61.  
  62. #define level_start
  63. // stop flying in between levels
  64. with(instances_matching(Player, "race", "raven")){
  65.     cooldown = 0;
  66.     fly_alarm = 0;
  67.     view_pan_factor[index] = 4;
  68.     // reset sprites
  69.     spr_idle = sprRavenIdle;
  70.     spr_walk = sprRavenWalk;
  71.     spr_fly = sprRavenFly;
  72.     mask_index = mskPlayer; // can get hit again
  73.     sound_play(sndRavenLand);
  74.     canwalk = 1;    // walk again
  75.     cooldown = 10;  // cooldown init
  76.     wkick = 0;  // show weapon
  77.     can_shoot = 1; // can shoot
  78.     reload = 1; // fix for stacking shots
  79.     // dust effect
  80.     repeat(5){
  81.         with(instance_create(x + irandom_range(-10, 10), y + irandom(4), Dust)){
  82.             direction = random(360);
  83.             speed = random_range(0.5, 1.5);
  84.         }
  85.     }
  86.     if(instance_exists(tempView)){
  87.         x = tempView.x;
  88.         y = tempView.y;
  89.         instance_delete(tempView);
  90.     }
  91.     view_object[index] = self;
  92.     canfly = 0;
  93. }
  94.  
  95.  
  96. #define game_start
  97. // executed after picking race and starting for each player picking this race
  98. // player-specific global variable init
  99.  
  100.  
  101. #define step
  102. // executed within each player instance of this race after step
  103. // most actives and passives handled here
  104.  
  105. // no weps
  106. canswap = 0;
  107. canpick = 0;
  108. if(wep != "raven"){
  109.     wep = "raven";
  110. }
  111.  
  112. // special - flight
  113. if(button_pressed(index, "spec")){
  114.     if(cooldown = 0 and canspec = 1){
  115.         // if floor inside borders...
  116.         if!(collision_point(mouse_x[index], mouse_y[index] - 8, Wall, false, true)){
  117.             if(collision_point(mouse_x[index], mouse_y[index] - 8, Floor, false, true)){
  118.                 if!(instance_number(enemy) = 0 and instance_exists(Portal)){
  119.                     // log coordinates for later and check for wall
  120.                     canfly = 0;
  121.                     coords[0] = mouse_x[index];
  122.                     coords[1] = mouse_y[index] - 8;
  123.                     coords[0] = round(coords[0]);
  124.                     coords[1] = round(coords[1]);
  125.                     var _x1 = coords[0];
  126.                     var _x2 = coords[0];
  127.                     var _y1 = coords[1];
  128.                     var _y2 = coords[1];
  129.                    
  130.                     // nearest 8 x
  131.                     while(_x1 % 8 != 0){
  132.                         _x1--;
  133.                     }
  134.                     while(_x2 % 8 != 0){
  135.                         _x2++;
  136.                     }
  137.                     if(_x1 < _x2){
  138.                         coords[0] = _x1;
  139.                     }
  140.                     else if(_x2 < _x1){
  141.                         coords[0] = _x2;
  142.                     }
  143.                     else{
  144.                         coords[0] = _x1;
  145.                     }
  146.                    
  147.                     // nearest 8 y
  148.                     while(_y1 % 8 != 0){
  149.                         _y1--;
  150.                     }
  151.                     while(_y2 % 8 != 0){
  152.                         _y2++;
  153.                     }
  154.                     if(_y1 < _y2){
  155.                         coords[1] = _y1;
  156.                     }
  157.                     else if(_y2 < _y1){
  158.                         coords[1] = _y2;
  159.                     }
  160.                     else{
  161.                         coords[1] = _y1;
  162.                     }
  163.                    
  164.                     // wall checks
  165.                     // just swap x
  166.                     if(place_meeting(coords[0], coords[1], Wall)){
  167.                         if(coords[0] = _x1){
  168.                             coords[0] = _x2;
  169.                         }
  170.                         else{
  171.                             coords[0] = _x1;
  172.                         }
  173.                     }
  174.                     else{
  175.                         canfly = 1;
  176.                     }
  177.                    
  178.                     // just swap y (swap x back)
  179.                     if(place_meeting(coords[0], coords[1], Wall)){
  180.                         if(coords[0] = _x1){
  181.                             coords[0] = _x2;
  182.                         }
  183.                         else{
  184.                             coords[0] = _x1;
  185.                         }
  186.                         if(coords[1] = _y1){
  187.                             coords[1] = _y2;
  188.                         }
  189.                         else{
  190.                             coords[1] = _y1;
  191.                         }
  192.                     }
  193.                     else{
  194.                         canfly = 1;
  195.                     }
  196.                     // swap x and y
  197.                     if(place_meeting(coords[0], coords[1], Wall) and canfly = 0){
  198.                         if(coords[1] = _y1){
  199.                             coords[1] = _y2;
  200.                         }
  201.                         else{
  202.                             coords[1] = _y1;
  203.                         }
  204.                         if(coords[1] = _y1){
  205.                             coords[1] = _y2;
  206.                         }
  207.                         else{
  208.                             coords[1] = _y1;
  209.                         }
  210.                     }
  211.                     else{
  212.                         canfly = 1;
  213.                     }
  214.                    
  215.                     if(canfly = 1){
  216.                         // start flying
  217.                         with(instance_create(x, y, Wall)){
  218.                             creator = other;
  219.                             mask_index = mskNone;
  220.                             sprite_index = mskNone;
  221.                             spr_shadow = shd24;
  222.                             topspr = mskNone;
  223.                             outspr = mskNone;
  224.                             name = "ravenview";
  225.                         }
  226.                         tempView_array = instances_matching(Wall, "creator", self);
  227.                         // if I can't make a wall
  228.                         if(array_length(tempView_array) = 0){
  229.                             with(instance_create(x, y, CustomObject)){
  230.                                 creator = other;
  231.                                 mask_index = mskNone;
  232.                                 sprite_index = mskNone;
  233.                                 spr_shadow = shd24;
  234.                                 name = "ravenview";
  235.                             }
  236.                             tempView_array = instances_matching(CustomObject, "creator", self);
  237.                         }
  238.                         tempView = tempView_array[0];
  239.                         view_object[index] = tempView;
  240.                         spr_idle = mskNone; // no sprite
  241.                         spr_walk = mskNone;
  242.                         spr_fly = sprRavenLift;
  243.                         mask_index = mskNone;   // no hit
  244.                         fly_index = 0;  // set index for flight sprite
  245.                         sound_play(sndRavenLift);
  246.                         cooldown = -1;
  247.                         fly_alarm = 40; // flight duration
  248.                         speed = 0;  // no sliding
  249.                         canwalk = 0;    // no walking
  250.                         can_shoot = 0; // no shooting
  251.                         // dust effect
  252.                         repeat(5){
  253.                             with(instance_create(x + irandom_range(-10, 10), y + irandom(4), Dust)){
  254.                                 direction = random(360);
  255.                                 speed = random_range(0.5, 1.5);
  256.                             }
  257.                         }
  258.                     }
  259.                 }
  260.             }
  261.         }
  262.     }
  263. }
  264.  
  265. if(instance_number(enemy) = 0 and instance_exists(Portal) and fly_alarm > 0){
  266.     fly_alarm = 0;
  267.     view_pan_factor[index] = 4;
  268.     // reset sprites
  269.     spr_idle = sprRavenIdle;
  270.     spr_walk = sprRavenWalk;
  271.     spr_fly = sprRavenFly;
  272.     mask_index = mskPlayer; // can get hit again
  273.     sound_play(sndRavenLand);
  274.     canwalk = 1;    // walk again
  275.     cooldown = 60;  // cooldown init
  276.     wkick = 0;  // show weapon
  277.     can_shoot = 1; // can shoot
  278.     reload = 1; // fix for stacking shots
  279.     // dust effect
  280.     repeat(5){
  281.         with(instance_create(tempView.x + irandom_range(-10, 10), tempView.y + irandom(4), Dust)){
  282.             direction = random(360);
  283.             speed = random_range(0.5, 1.5);
  284.         }
  285.     }
  286.     if(instance_exists(tempView)){
  287.         x = tempView.x;
  288.         y = tempView.y;
  289.         instance_delete(tempView);
  290.     }
  291.     view_object[index] = self;
  292.     canfly = 0;
  293. }
  294.  
  295. // flying!
  296. if(fly_alarm > 0){
  297.     view_pan_factor[index] = 22;    // limit mouse pan
  298.     script_bind_draw(draw_flight, -999, id, fly_alarm, fly_index);
  299.     wkick = 99999;  // hide weapon
  300.     fly_alarm-= current_time_scale; // alarm management
  301.     can_shoot = 0;
  302.    
  303.     // sprite management
  304.     if(fly_alarm = 25){
  305.         spr_fly = sprRavenFly;
  306.     }
  307.     else if(fly_alarm = 20){
  308.         // move view
  309.         with(tempView){
  310.             x = creator.coords[0];
  311.             y = creator.coords[1];
  312.             // move player
  313.             creator.x = creator.coords[0];
  314.             creator.y = creator.coords[1];
  315.         }
  316.     }
  317.     else if(fly_alarm = 15){
  318.         spr_fly = sprRavenLand;
  319.     }
  320.    
  321.     if(fly_alarm = 0){
  322.         view_pan_factor[index] = 4;
  323.         // reset sprites
  324.         spr_idle = sprRavenIdle;
  325.         spr_walk = sprRavenWalk;
  326.         spr_fly = sprRavenFly;
  327.         mask_index = mskPlayer; // can get hit again
  328.         sound_play(sndRavenLand);
  329.         canwalk = 1;    // walk again
  330.         cooldown = 60;  // cooldown init
  331.         wkick = 0;  // show weapon
  332.         can_shoot = 1; // can shoot
  333.         reload = 1; // fix for stacking shots
  334.         // dust effect
  335.         repeat(5){
  336.             with(instance_create(tempView.x + irandom_range(-10, 10), tempView.y + irandom(4), Dust)){
  337.                 direction = random(360);
  338.                 speed = random_range(0.5, 1.5);
  339.             }
  340.         }
  341.         view_object[index] = self;
  342.         instance_delete(tempView);
  343.         canfly = 0;
  344.     }
  345. }
  346.  
  347. // cooldown management
  348. if(cooldown > 0){
  349.     if(cooldown = 1){
  350.         sound_play(sndRavenScreech);    // cooldown screech
  351.     }
  352.     cooldown-= current_time_scale;
  353. }
  354.  
  355. // index management
  356. if(fly_index < sprite_get_number(spr_fly)){
  357.     fly_index +=  current_time_scale * image_speed;
  358. }
  359. else{
  360.     fly_index = 0;
  361. }
  362.  
  363. // on death
  364. if(my_health = 0 and died = 0){
  365.     // effects
  366.     for(i = 0; i < 360; i += 120){
  367.         with(instance_create(x, y, Feather)){
  368.             speed = 8;
  369.             direction = other.i + random_range(-30, 30);
  370.         }
  371.     }
  372.     died = 1;
  373. }
  374.  
  375.  
  376. #define draw_flight(id, fly_alarm)
  377. with(id){
  378.     if(instance_exists(tempView)){
  379.         if(fly_alarm >= 20){
  380.             d3d_set_fog(1,player_get_color(index),0,0);
  381.             draw_sprite_ext(spr_fly, fly_index, tempView.x - 1, tempView.y - (180 - ((fly_alarm - 20) * 8)), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  382.             draw_sprite_ext(spr_fly, fly_index, tempView.x + 1, tempView.y - (180 - ((fly_alarm - 20) * 8)), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  383.             draw_sprite_ext(spr_fly, fly_index, tempView.x, tempView.y - 1 - (180 - ((fly_alarm - 20) * 8)), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  384.             draw_sprite_ext(spr_fly, fly_index, tempView.x, tempView.y + 1 - (180 - ((fly_alarm - 20) * 8)), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  385.             d3d_set_fog(0,c_lime,0,0);
  386.             draw_sprite_ext(spr_fly, fly_index, tempView.x, tempView.y - (180 - ((fly_alarm - 20) * 8)), image_xscale * right, image_yscale, sprite_angle, c_white, 1);
  387.         }
  388.         else{
  389.         d3d_set_fog(1,player_get_color(index),0,0);
  390.             draw_sprite_ext(spr_fly, fly_index, tempView.x - 1, tempView.y - (fly_alarm * 8), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  391.             draw_sprite_ext(spr_fly, fly_index, tempView.x + 1, tempView.y - (fly_alarm * 8), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  392.             draw_sprite_ext(spr_fly, fly_index, tempView.x, tempView.y - 1 - (fly_alarm * 8), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  393.             draw_sprite_ext(spr_fly, fly_index, tempView.x, tempView.y + 1 - (fly_alarm * 8), image_xscale * right, image_yscale, sprite_angle, player_get_color(index), 1);
  394.             d3d_set_fog(0,c_lime,0,0);
  395.             draw_sprite_ext(spr_fly, fly_index, tempView.x, tempView.y - (fly_alarm * 8), image_xscale * right, image_yscale, sprite_angle, c_white, 1);
  396.         }
  397.        
  398.     }
  399. }
  400. instance_destroy();
  401.  
  402. #define race_name
  403. // return race name for character select and various menus
  404. return "RAVEN";
  405.  
  406.  
  407. #define race_text
  408. // return passive and active for character selection screen
  409. return "TOMMY GUN#@sCAN @wFLY";
  410.  
  411.  
  412. #define race_portrait
  413. // return portrait for character selection screen and pause menu
  414. return global.sprPortrait;
  415.  
  416.  
  417. #define race_mapicon
  418. // return sprite for loading/pause menu map
  419. return sprMapIconChickenHeadless;
  420.  
  421.  
  422. #define race_swep
  423. // return ID for race starting weapon
  424. return "raven";
  425.  
  426.  
  427. #define race_avail
  428. // return if race is unlocked
  429. return 1;
  430.  
  431.  
  432. #define race_menu_button
  433. // return race menu button icon
  434. sprite_index = global.sprMenuButton;
  435.  
  436. #define race_skins
  437. // return number of skins the race has
  438. return 1;
  439.  
  440.  
  441. #define race_skin_avail
  442. // return if skin is unlocked
  443. return 1;
  444.  
  445. #define race_skin_button
  446. // return skin switch button sprite
  447. return sprMapIconChickenHeadless;
  448.  
  449.  
  450. #define race_soundbank
  451. // return build in race id for default sounds
  452. return 0;
  453.  
  454.  
  455. #define race_tb_text
  456. // return description for Throne Butt
  457. return "DOES NOTHING";
  458.  
  459.  
  460. #define race_tb_take
  461. // run when Throne Butt is taken
  462. // player of race may not be alive at the time
  463.  
  464. #define race_ultra_name
  465. // return a name for each ultra
  466. // determines how many ultras are shown
  467. switch(argument0){
  468.     case 1: return "NOTHING";
  469.     default: return "";
  470. }
  471.  
  472.  
  473. #define race_ultra_text
  474. // recieves ultra mutation index and returns description
  475. switch(argument0){
  476.     case 1: return "DOES NOTHING";
  477.     default: return "";
  478. }
  479.  
  480.  
  481. #define race_ultra_button
  482. // called by ultra mutation button on creation
  483. // recieves ultra mutation index
  484. switch(argument0){
  485.     case 1: return mskNone;
  486. }
  487.  
  488.  
  489. #define race_ultra_take
  490. // recieves ultra mutation index
  491. // called when ultra for race is picked
  492. // player of race may not be alive at the time
  493.  
  494.  
  495. #define race_ttip
  496. // return character-specific tooltips
  497. return choose("SOARING...", "INCOMING", "Z AXIS", "TOP OF THE PECKING ORDER", "NEVERMORE");
  498.  
  499. #define draw_outline(playerColor, toDraw)
  500. d3d_set_fog(1,playerColor,0,0);
  501. if(instance_exists(toDraw)){
  502.     with(toDraw){
  503.         draw_sprite_ext(sprite_index, -1, x - 1, y, 1 * right, 1, 0, playerColor, 1);
  504.         draw_sprite_ext(sprite_index, -1, x + 1, y, 1 * right, 1, 0, playerColor, 1);
  505.         draw_sprite_ext(sprite_index, -1, x, y - 1, 1 * right, 1, 0, playerColor, 1);
  506.         draw_sprite_ext(sprite_index, -1, x, y + 1, 1 * right, 1, 0, playerColor, 1);
  507.     }
  508. }
  509. d3d_set_fog(0,c_lime,0,0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement