Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _____ _ _ _____ _ _ _____ _
- | __ (_) | |/ ____| | (_) / ____| | |
- | |__) |__ _____| | | | |__ _ _ __ | | ___ __| | ___
- | ___/ \ \/ / _ \ | | | '_ \| | '_ \| | / _ \ / _` |/ _ \
- | | | |> < __/ | |____| | | | | |_) | |___| (_) | (_| | __/
- |_| |_/_/\_\___|_|\_____|_| |_|_| .__/ \_____\___/ \__,_|\___|
- | |
- |_|
- = = = = = obj_sun_particle
- // Create Event
- life = 0; // Initialize life of the particle to 0
- life_span = random_range(30, 100); // Set a random lifespan between 30 and 100 steps
- direction = random(360); // Randomize direction of movement (0-360 degrees)
- speed = random_range(0.01, 0.1); // Randomize speed of the particle between 0.01 and 0.1
- // Step Event
- life++; // Increase the particle's life by 1 step
- if (life > life_span) {
- instance_destroy(); // Destroy the particle if it has lived longer than its lifespan
- }
- = = = = = obj_sun_particle_emitter
- // Step Event
- var random_angle = irandom_range(0, 359); // Generate a random angle in degrees
- var radians = degtorad(random_angle); // Convert the random angle to radians
- // Calculate the position along the orbit with a radius of 30
- var orbit_x = 73 + 30 * cos(radians); // X position based on the random angle
- var orbit_y = 90 + 30 * sin(radians); // Y position based on the random angle
- // Create 50 particles at the calculated orbit position
- repeat(50) {
- instance_create_layer(orbit_x, orbit_y, "Instances", obj_sun_particle);
- }
- // Slightly randomize the direction for variation in movement
- direction += random_range(-1, 1);
- = = = = = obj_UI_dial
- // Create event
- image_angle = 0; // Set the initial rotation of the sprite
- previous_mouse_angle = 0; // Store the previous mouse angle
- mouse_touching = false; // Flag to indicate if mouse is touching the sprite
- // Step event
- if (point_distance(x, y, mouse_x, mouse_y) <= sprite_width / 2) {
- // Mouse is touching the sprite
- mouse_touching = true;
- } else {
- // Mouse is not touching the sprite
- mouse_touching = false;
- }
- if (mouse_touching && mouse_check_button_pressed(mb_left)) {
- // Calculate the angle between the sprite and the mouse position
- previous_mouse_angle = point_direction(x, y, mouse_x, mouse_y);
- } else if (mouse_touching && mouse_check_button(mb_left)) {
- // Calculate the angle of rotation based on the mouse movement
- var mouse_angle = point_direction(x, y, mouse_x, mouse_y);
- var drag_angle = angle_difference(mouse_angle, previous_mouse_angle);
- // Rotate the sprite by the drag angle
- image_angle += drag_angle;
- // Store the current mouse angle as the previous mouse angle for the next step
- previous_mouse_angle = mouse_angle;
- }
- = = = = = obj_UI_slider
- // Create event
- slider_x = 100; // Set the initial position of the slider
- slider_width = 100; // Set the width of the slider
- slider_height = 20; // Set the height of the slider
- slider_min = 0; // Set the minimum value of the slider
- slider_max = 100; // Set the maximum value of the slider
- slider_value = slider_min; // Set the initial value of the slider
- slider_dragging = false; // Set dragging flag to false
- //Step event
- if (mouse_check_button_pressed(mb_left)) {
- // Check if the mouse is over the slider
- if (mouse_x > slider_x && mouse_x < slider_x + slider_width &&
- mouse_y > y && mouse_y < y + slider_height) {
- slider_dragging = true; // Set dragging flag to true
- }
- } else if (mouse_check_button(mb_left)) {
- // If dragging, update the slider value based on the mouse position
- if (slider_dragging) {
- var percent = (mouse_x - slider_x) / slider_width;
- slider_value = clamp(slider_min + percent * (slider_max - slider_min), slider_min, slider_max);
- }
- } else {
- // Set dragging flag to false when mouse is released
- slider_dragging = false;
- }
- // Draw event
- draw_set_color(c_gray);
- draw_rectangle(slider_x, y, slider_x + slider_width, y + slider_height, false);
- draw_set_color(c_lime);
- var slider_percent = (slider_value - slider_min) / (slider_max - slider_min);
- //draw_rectangle(slider_x, y, slider_x + slider_width * slider_percent, y + slider_height, true); //fills bar
- draw_rectangle(slider_x + slider_width * slider_percent, y, slider_x + slider_width * slider_percent, y + slider_height, true);
- draw_text(10,10,slider_percent)
Advertisement
Add Comment
Please, Sign In to add comment