Whats the syntax and command to delay a script execution, i have key inputs and after it will detect key input i want it to wait before performing velocity change.
How would i do that ?
I need it cause to make key inputs detection work best i need delay1 and with delay1 velocity change is immediate all the time, its kinda insane, so i need something to introduce delay so when i press left or right, velocity change will be applied after lets say half second.
Its very easy to do in godot where i would just put command before velocity change and engine would not go to velocity change until that first delay command was finished, but in openbor i dont think i encountered such scripts.
I suspect its super easy in openbor and its just my noobhour at its best.
This would get me delay in godot before executing music play, do we have something like this in openbor ?
How would i do that ?
I need it cause to make key inputs detection work best i need delay1 and with delay1 velocity change is immediate all the time, its kinda insane, so i need something to introduce delay so when i press left or right, velocity change will be applied after lets say half second.
Its very easy to do in godot where i would just put command before velocity change and engine would not go to velocity change until that first delay command was finished, but in openbor i dont think i encountered such scripts.
I suspect its super easy in openbor and its just my noobhour at its best.
Code:
@script
void self = getlocalvar("self");
int sped = getentityproperty(self, "speed");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
void a1 = playerkeys(iPIndex, 0, "jump");
void d1 = playerkeys(iPIndex, 0, "movedown");
if ( a1 && openborvariant("elapsed_time")+2000 ){
openborvariant("elapsed_time")+2000 ;
changeentityproperty(self, "velocity", 0 ,-sped);
}
if ( !a1 ){
openborvariant("elapsed_time")+2000 ;
changeentityproperty(self, "velocity", 0 ,0);
}
if (( d1 )&&(a1)){
openborvariant("elapsed_time")+2000 ;
changeentityproperty(self, "velocity", 0 ,sped);
}
@end_script
This would get me delay in godot before executing music play, do we have something like this in openbor ?
Code:
yield(get_tree().create_timer(0.5), "timeout")
$Music.play()