XD005
Member
Hello everyone,
I've been ripping my hair out over this for a while.
The solution is probably simple and I'm just overlooking things...
I am trying to create a note speed script that will create the objects in such a manner that they arrive to the target on-time while allowing their speed to be adjusted mid-travel.
If possible, I need them to respect each other's size. If the scrolling speed is too low, notes stack on top of each other. If this isn't possible, I can live without it.
This is the current code....
Object creation code
And then the node objects
Any help with this is appreciated
I've been ripping my hair out over this for a while.
The solution is probably simple and I'm just overlooking things...
I am trying to create a note speed script that will create the objects in such a manner that they arrive to the target on-time while allowing their speed to be adjusted mid-travel.
If possible, I need them to respect each other's size. If the scrolling speed is too low, notes stack on top of each other. If this isn't possible, I can live without it.
This is the current code....
Object creation code
GML:
var note_travel_time_ms = (point_distance(spawn_x,spawn_y,zone_x,zone_y) / global.gem_speed) * (1000/room_speed);
//Note_millisecond is the time the note should be perfectly lined up with the target
var duration = (note_travel_time_ms/global.gem_speed);
if (global.millisecond >= (note_millisecond - duration)){
index_id = instance_create_layer(spawn_x,spawn_y,"Gameplay_Foreground",obj_node);
}
GML:
//Timing prog is the percentage until the note should have been on the target perfectly
var timing_prog = (global.millisecond - timecapture) / (node_time - timecapture);
timing_progress += (delta_time/1000000);
x = lerp (startx, obj_discs_controller.zone1_x, timing_progress*global.gem_speed);
y = lerp (starty, obj_discs_controller.zone1_y, timing_progress*global.gem_speed);
//Old method using progress of time instead of elapsed time since creation
//x = lerp(startx, obj_discs_controller.zone1_x, timing_prog);
//y = lerp(starty, obj_discs_controller.zone1_y, timing_prog);