Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

It’s not possible currently with that script. For my own games I have moved the objects one by one.

This seems like something very necessary though, so I quickly wrote a script for this:

/// @function cutscene_move_objects
/// @description Moves many objects to specified positions, with the specified speeds
/// @arg {array} objects
/// @arg {array} x
/// @arg {array} y
/// @arg {array} speed
/// @arg {array}  [radius]
function cutscene_move_objects(_obj,_x,_y,_spd,_radius) {

	var _obj_amount = array_length(_obj);
	
	// Handle _radius array
	if (_radius != undefined) {
		if (array_length(_radius) < _obj_amount) {
			array_resize(_radius,_obj_amount);
			for (var _i=0;_i<_obj_amount;_i++) {
				if (_radius[_i] == 0) {
					_radius[_i] = 20;
				}
			}
		}
	}else{
		// Create the array with a default value
		_radius = array_create(_obj_amount,20);
	}
	
	// Move them all
	var _objects_done = 0;
	for (var _i=0;_i<_obj_amount;_i++;) {
		with(_obj[_i]) {
			// If in the wanted place
			if (distance_to_point(_x[_i],_y[_i])<_radius[_i]) {
				// Stop
				speed = 0;
				_objects_done ++;
			}else{
				// Move to the place
				move_towards_point(_x[_i],_y[_i],_spd[_i]);
			}
		}
	}
	
	// End scene if all done
	if (_objects_done == _obj_amount) {
		cutscene_next();
	}

}

/*
---Example---

--Before the scene_info 2d array:--
var object_array = [example_player,example_npc1];
var x_array = [170,600];
var y_array = [300,100];
var speed_array = [2,5];

--In the scene_info 2d array:--
[cutscene_move_objects,object_array,x_array,y_array,speed_array]

--This moves the object example_player to position x 170, y 300 with speed 2, and example_npc1 to position x 600, y 100, with speed 5.--
*/

That was more complicated than I expected. :) I didn’t test the script much yet, so let me know if there is some problem or if you need help using it.

I will probably add this to the Cutscene engine with the next update.

Pikku-a my goat lol!!! I'll test this, thanks so much!