GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Script Submission » draw_sprite_animated » 2023-03-07 18:20:15

helloitscrash
Replies: 1

This is much simpler to use than creating a bunch of different variables to use for one function, plus it all takes place in one line.

Expand/// draw_sprite_animated(spr, _x, _y);
//
//  Draw an animated sprite at an x and y coordinate, based on its original image speed as set in the sprite editor.
//  spr     The sprite you want to draw
//   _x     The x position to draw the sprite
//   _y     The y position to draw the sprite
//
//  Unlike draw_sprite(), there is no space for a sub-image; that is calculated automatically with the script
//
/// GMLscripts.com/license
function draw_sprite_animated(spr,_x,_y) {
  var _t = (current_time/1000) * sprite_get_speed(spr);
  return draw_sprite(spr,_t,_x,_y);
}

#2 Script Submission » string_random_case » 2023-03-07 18:15:30

helloitscrash
Replies: 0

Have a sarcastic character in your game? Want your text to be more unique? This may be helpful.

Expand/// string_random_case(str);
//
//  Convert each letter in a string to either uppercase or lowercase, at random.
//
/// GMLscripts.com/license
function string_random_case(str) {
    var origstring = str;
    var stringarray = [];
    var finalstring = "";
    for(var i = 1; i < string_length(origstring); i++) {
        stringarray[i] = string_char_at(origstring,i);
        stringarray[i] = choose(string_upper(stringarray[i]),string_lower(stringarray[i]));
        finalstring += stringarray[i];
    }
    return finalstring;
}

Board footer

Powered by FluxBB