SemiMetalAlchemist

obj_crops_meta Step Event

Mar 23rd, 2018
736
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @description
  2. // You can write your code in this editor
  3. if(room != room_outside){ planting = false; exit; }     ///Only allowed to plant in outisde room
  4.  
  5.  
  6.  
  7. #region Planting
  8. if(keyboard_check_pressed(ord("P"))){planting = !planting }
  9.  
  10. if(planting){
  11.     mx = mouse_x;
  12.     my = mouse_y;
  13.    
  14.     if(mouse_wheel_up()) selectCrop += 1;
  15.     if(mouse_wheel_down()) selectCrop -= 1;
  16.    
  17.     if(selectCrop > sprite_get_number(spr_crops_picked)-1)  {   selectCrop = 0;}
  18.     else if (selectCrop <0) {selectCrop = sprite_get_number(spr_crops_picked)-1; }
  19.     if (mouse_check_button_pressed(mb_left)){
  20.         instance_create_crop(mx, my, selectCrop);
  21.     }
  22. }
  23. #endregion
  24.  
  25. if(instance_exists(obj_crops) and keyboard_check_pressed(ord("G"))){
  26.         with(obj_crops){
  27.             if(growthStage < maxGrowthStage){
  28.             daysOld += 1;
  29.            
  30.             //First Growth
  31.             var firstGrowth = 0;
  32.             if(daysOld > 0){ firstGrowth = 1; }
  33.            
  34.            
  35.             growthStage = firstGrowth + daysOld div growthStageDuration;
  36.             } else {
  37.                 growthStage = maxGrowthStage;
  38.                 fullyGrown = true;
  39.                 alarm[1] = 1;
  40.         }
  41. }
  42. }
Advertisement