• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

script in function GMS 2.3

Sorry english is not my first language.
Help write a script for GMS 2.3.
This is taken from Shaun Spalding's tutorial, GameMaker Studio 2: Action RPG Tutorial (Part 18: Entity Fragments # 2).
https://www.youtube.com/watch?v=9pKFv5nHHS4&list=PLPRT_JORnIuosvhfax2TQTEmN7OYTcSvK&index=20

Code:
/// @desc scr_Drop_item(x, y, [items])
/// @arg x
/// @arg y
/// @arg [items]
    var _items = array_length(argument2);
    if (_items > 1) {
        var _angle_per_item = 360/_items;
        var _angle = random(360);
        for (var _i = 0; _i < _items; _i ++) {
            with (instance_create_layer(argument0, argument1, "Instances", argument2[_i])) {
            direction = _angle;
            spd = 0.75 + (_items * 0.1) + random(0.1);
            }
            _angle += _angle_per_item;
        }
    } else instance_create_layer(argument0, argument1, "Instances", argument2[0]);
 

FrostyCat

Redemption Seeker
You are using old syntax in a new version of GMS. Stop doing that.
GML:
/// @desc scr_Drop_item(xx, yy, [items])
/// @arg xx
/// @arg yy
/// @arg [items]
function scr_Drop_item(xx, yy, items) {
    var _items = array_length(items);
    if (_items > 1) {
        var _angle_per_item = 360/_items;
        var _angle = random(360);
        for (var _i = 0; _i < _items; _i ++) {
            with (instance_create_layer(xx, yy, "Instances", items[_i])) {
            direction = _angle;
            spd = 0.75 + (_items * 0.1) + random(0.1);
            }
            _angle += _angle_per_item;
        }
    } else instance_create_layer(xx, yy, "Instances", items[0]);
}
I suggest that you start with a tutorial on this page that teaches the latest syntax and get used to that first, before trying to work with random tutorials on YouTube that are likely designed for older versions and need manual adjustment to work.
 
Top