Advertisement
TJSJ

RolloMania

Jun 3rd, 2021
1,754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Information about object: obj_sawling
  2. Sprite: spr_sawling_idle
  3. Solid: false
  4. Visible: true
  5. Depth: 0
  6. Persistent: false
  7. Parent: ParEnemy
  8. Children:
  9. Mask:
  10.  
  11. No Physics Object
  12. Create Event:
  13.  
  14. execute code:
  15.  
  16. image_speed = 0;
  17. alarm[0] = 120;
  18.  
  19. //orbit_angle = 180;
  20. //orbit_radius = 80;
  21. //orbit_speed  = 3;
  22. //inst_amount = 1;
  23.  
  24. is_moving = false;
  25. my_parent = 0;
  26. orbit_angle = 0;
  27. orbit_speed  = 18;
  28. inst_amount = 3; //CAN CHANGE
  29. angle_offset = 0; //WOULD NOT CHANGE
  30. i = 0
  31. new_offset = 720/inst_amount
  32.  
  33. while x < 128 || x > room_width-128
  34. || x < obj_ball.x+120 || y < 128 || y > room_height-128 {
  35.     x = irandom_range(0,room_width);
  36.     y = irandom_range(0,room_height);
  37.     }
  38.  
  39. Alarm Event for alarm 0:
  40.  
  41. execute code:
  42.  
  43. alarm[0] = 210;
  44. if is_moving = false {
  45.     is_moving = true;
  46.     } else {
  47.     is_moving = false;
  48.     speed = 0;
  49.     }
  50.  
  51. Step Event:
  52.  
  53. execute code:
  54.  
  55. movespeed = 1.04+(0.05*Events.level);
  56. if instance_exists(obj_ball) && is_moving = true && Events.faint = false {
  57.  
  58.     if obj_ball.x <= x {
  59.         image_index = 2;
  60.         }
  61.     if obj_ball.x > x {
  62.         image_index = 1;
  63.         }
  64.        
  65. if instance_exists(obj_ball) {
  66.     saw_direction = move_towards_point(obj_ball.x,obj_ball.y,movespeed);
  67.     }
  68.    
  69. if place_meeting(x,y,ParEnemy) {
  70.     with instance_place(x,y,obj_sawling) {
  71.         move_towards_point(other.x,other.y,-movespeed); //-towards = away
  72.     }
  73. }
  74.  
  75.    
  76. }
  77.  
  78. if is_moving = false {
  79.     image_index = 0;
  80.     speed = 0;
  81.     }
  82.    
  83.  
  84. if i < inst_amount
  85. {
  86. for(i=0; i < inst_amount; i+=1)
  87.     {
  88.     with(instance_create(x,y,obj_sawling_blade))
  89.         {
  90.         orbit_parent = other.my_parent
  91.         orbit_angle = other.orbit_angle+other.angle_offset
  92.         orbit_speed = other.orbit_speed
  93.         image_angle = orbit_angle
  94.         image_xscale = other.image_xscale
  95.         image_yscale = other.image_yscale
  96.         }
  97.     angle_offset += new_offset
  98.     }
  99. }
  100.  
  101. Information about object: obj_sawling_blade
  102. Sprite: spr_sawling_blade
  103. Solid: false
  104. Visible: true
  105. Depth: 1999
  106. Persistent: false
  107. Parent: ParEnemy
  108. Children:
  109. Mask:
  110.  
  111. No Physics Object
  112. Create Event:
  113.  
  114. execute code:
  115.  
  116. orbit_angle = 0;
  117. orbit_radius = 0;
  118. orbit_speed  = 4;
  119. orbit_parent = instance_nearest(x,y,obj_sawling);
  120.  
  121. Step Event:
  122.  
  123. execute code:
  124.  
  125. image_angle = orbit_angle;
  126.  
  127. if instance_nearest(x,y,obj_sawling).is_moving = true {
  128.     //orbit_angle += orbit_speed;
  129.     }
  130.    
  131.  
  132. if instance_exists(instance_nearest(x,y,obj_sawling)) && instance_nearest(x,y,obj_sawling).is_moving = true
  133.             {
  134.             orbit_angle += orbit_speed;
  135.             x = instance_nearest(x,y,obj_sawling).x + orbit_radius * cos(orbit_angle * pi / 360);
  136.             y = instance_nearest(x,y,obj_sawling).y - orbit_radius * sin(orbit_angle * pi / 360);
  137.             }
  138.  
  139. Draw Event:
  140.  
  141. execute code:
  142.  
  143. draw_self()
  144.  
  145. Information about object: Events
  146. Sprite:
  147. Solid: false
  148. Visible: true
  149. Depth: -100
  150. Persistent: true
  151. Parent:
  152. Children:
  153. Mask:
  154.  
  155. No Physics Object
  156. Create Event:
  157.  
  158. execute code:
  159.  
  160. game_over = false;
  161. faint = false;
  162. set_alarm = false;
  163. level_won = false;
  164. level = 1;
  165. lifes = 3;
  166.  
  167.  
  168. Alarm Event for alarm 0:
  169.  
  170. execute code:
  171.  
  172. ///reset after faint
  173.  
  174. if lifes = 1 && faint = true {
  175.     audio_play_sound(snd_game_stop,1,false);
  176.     game_over = true;
  177.     }
  178.  
  179. if lifes >= 1 && set_alarm = true {
  180.     room_restart();
  181.     alarm[0] = -1
  182.     if level_won = true {
  183.         level += 1;
  184.         }
  185.     set_alarm = false;
  186.     level_won = false;
  187.     }
  188.  
  189. if faint = true {
  190.     lifes -= 1;
  191.     faint = false;
  192.     }
  193.    
  194.  
  195. Step Event:
  196.  
  197. execute code:
  198.  
  199. if keyboard_check(vk_shift) {
  200.     game_restart();
  201.     }
  202.  
  203. if room = intro_screen && keyboard_check(vk_space) {
  204.     room_goto(ball_room);
  205.     }
  206.  
  207. if faint = true || level_won = true
  208. if set_alarm = false {
  209.     alarm[0] = 180;
  210.     set_alarm = true;
  211.     }
  212.    
  213. if instance_exists(obj_medal)
  214. if instance_nearest(x,y,obj_medal).is_collected = true {
  215.     level_won = true;
  216.     }
  217.    
  218. if keyboard_check(vk_shift) && game_over = true {
  219.     game_restart();
  220.     }
  221.    
  222. //window_set_size(800,600);
  223.  
  224. Draw Event:
  225.  
  226. execute code:
  227.  
  228. title = "RolloMania";
  229. titledesc = "Press Space to Start!";
  230. version = "Version 0.13";
  231.  
  232. draw_set_font(font_title);
  233. if room = intro_screen {
  234.     text_draw(view_xview+view_wview/2-string_width(title)/2,view_yview+64,title,c_white);
  235.     draw_set_font(font_main);
  236.     text_draw(view_xview+view_wview/2-string_width(titledesc)/2,view_yview+200,titledesc,c_white);
  237.     text_draw(view_xview+8,view_yview+view_hview-16,version,c_yellow);
  238.     }
  239.  
  240. draw_set_font(font_main);
  241.  
  242. if Events.faint = true {
  243.     draw_set_color(c_black);
  244.     draw_set_alpha(0.8);
  245.     draw_rectangle(view_xview,view_yview,view_xview+view_wview,view_yview+view_hview,false);
  246.     }
  247.    
  248. if Events.game_over = true {
  249.     draw_set_color(c_black);
  250.     draw_set_alpha(0.9);
  251.     draw_rectangle(view_xview,view_yview,view_xview+view_wview,view_yview+view_hview,false);
  252.     draw_set_alpha(1);
  253.     }
  254.    
  255. if Events.level_won = true {
  256.     draw_set_color(c_yellow);
  257.     draw_set_alpha(0.2);
  258.     draw_rectangle(view_xview,view_yview,view_xview+view_wview,view_yview+view_hview,false);
  259.     draw_set_alpha(1);
  260.     }
  261.    
  262. level_text = "Level "+string(level);
  263.  
  264. if room = ball_room {
  265. if Events.faint = false || Events.level_won = false {
  266. text_draw(view_xview+view_wview/2-string_width(level_text)/2,view_yview+16,level_text,c_yellow);
  267. text_draw(view_xview+16,view_yview+16,"Lives: "+string(lifes),c_white);
  268. }
  269.  
  270. if Events.game_over = true {
  271.     text_draw(view_xview+view_wview/2-(string_width("Game Stop")/2),view_yview+view_hview/2,"Game Stop",c_orange);
  272.     text_draw(view_xview+view_wview/2-string_width("(Press Shift to Restart)")/2,view_yview+view_hview/2+32,"(Press Shift to Restart)",c_orange);
  273.     }
  274. }
  275.  
  276. Information about object: obj_ball_faint
  277. Sprite: spr_ball_faint
  278. Solid: false
  279. Visible: true
  280. Depth: -10000
  281. Persistent: false
  282. Parent:
  283. Children:
  284. Mask:
  285.  
  286. No Physics Object
  287. Create Event:
  288.  
  289. execute code:
  290.  
  291. vspeed = 0;
  292. Events.faint = true;
  293.  
  294. Step Event:
  295.  
  296. execute code:
  297.  
  298. vspeed -= 0.02;
  299.  
  300. Information about object: obj_medal
  301. Sprite: spr_victory_medal
  302. Solid: false
  303. Visible: true
  304. Depth: 0
  305. Persistent: false
  306. Parent:
  307. Children:
  308. Mask:
  309.  
  310. No Physics Object
  311. Create Event:
  312.  
  313. execute code:
  314.  
  315. image_speed = 0.3;
  316. is_collected = false;
  317. is_moving = false;
  318. while x < 128 || x > room_width-128
  319. || x < obj_ball.x+120 || y < 128 || y > room_height-128 {
  320.     x = irandom_range(0,room_width);
  321.     y = irandom_range(0,room_height);
  322.     }
  323.  
  324.  
  325. Step Event:
  326.  
  327. execute code:
  328.  
  329.  
  330.  
  331. if place_meeting(x,y,obj_ball) && distance_to_object(instance_nearest(x,y,obj_ball)) < 20 {
  332.     is_collected = true;
  333.     image_speed = 0.4;
  334.     }
  335.  
  336. if is_collected = true && is_moving = false {
  337.     vspeed = 4;
  338.     audio_play_sound(snd_medal,1,false);
  339.     is_moving = true;
  340.     }
  341.    
  342. if is_moving = true {
  343.     hspeed = 0;
  344.     vspeed -= 0.25;
  345.     }
  346.  
  347. Information about object: obj_ball
  348. Sprite: spr_ball_vmove
  349. Solid: false
  350. Visible: true
  351. Depth: 0
  352. Persistent: false
  353. Parent:
  354. Children:
  355. Mask:
  356.  
  357. No Physics Object
  358. Create Event:
  359.  
  360. execute code:
  361.  
  362. image_speed = 0;
  363. move_speed = 0;
  364. if !instance_exists(Events) {
  365.     instance_create(0,0,Events);
  366.     }
  367.  
  368.  
  369. Step Event:
  370.  
  371. execute code:
  372.  
  373. left = keyboard_check(vk_left);
  374. right = keyboard_check(vk_right);
  375. up = keyboard_check(vk_up);
  376. down = keyboard_check(vk_down);
  377.  
  378. if !up && !down && !right && !left {
  379.     move_speed = 0;
  380.     hspeed = 0;
  381.     vspeed = 0;
  382.     sprite_index = spr_ball_vmove;
  383.     image_index = 0;
  384.     image_speed = 0;
  385.     image_xscale = 1;
  386.     image_yscale = 1;
  387.     } else {
  388.     move_speed = 3;
  389.     }
  390.  
  391. if instance_exists(Events) && Events.faint = false && Events.level_won = false {
  392.  
  393. if place_meeting(x,y,ParEnemy) && Events.level_won = false {
  394.     instance_create(x,y,obj_ball_faint);
  395.     instance_destroy();
  396.     audio_play_sound(snd_ball_faint,1,false);
  397.     }
  398.    
  399. if left || right || up || down
  400. if !audio_is_playing(snd_ball_move) && Events.level_won = false {
  401.     audio_play_sound(snd_ball_move,1,false);
  402.     }
  403.    
  404. if x <= 32 {
  405.     hspeed = 0;
  406.     x+=1;
  407.     }
  408. if x >= room_width-32 {
  409.     hspeed = 0;
  410.     x-=1;
  411.     }
  412. if y <= 32 {
  413.     vspeed = 0;
  414.     y+=1;
  415.     }
  416. if y >= room_height-32 {
  417.     vspeed = 0;
  418.     y-=1;
  419.     }
  420.  
  421. if left && Events.level_won = false && x > 32 {
  422.     sprite_index = spr_ball_hmove;
  423.     image_speed = 0.2;
  424.     image_xscale = -1;
  425.     image_yscale = 1;
  426.     hspeed = -move_speed;
  427.     vspeed = 0;
  428.     }
  429.    
  430. if right && Events.level_won = false && x < room_width-32 {
  431.     sprite_index = spr_ball_hmove;
  432.     image_speed = 0.2;
  433.     image_xscale = 1;
  434.     image_yscale = 1;
  435.     hspeed = move_speed;
  436.     vspeed = 0;
  437.     }
  438.    
  439. if up && Events.level_won = false && y > 32 {
  440.     sprite_index = spr_ball_vmove;
  441.     image_speed = 0.2;
  442.     image_xscale = 1;
  443.     image_yscale = 1;
  444.     hspeed = 0;
  445.     vspeed = -move_speed;
  446.     }
  447.    
  448. if down && Events.level_won = false && y < room_height-32 {
  449.     sprite_index = spr_ball_vmove;
  450.     image_speed = 0.2;
  451.     image_xscale = 1;
  452.     image_yscale = -1;
  453.     hspeed = 0;
  454.     vspeed = move_speed;
  455.     }
  456.    
  457. }
  458.  
  459.  
  460.  
  461.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement