I don't know if it should be this way, but if it does than it's just really bad and disgusting. I've tried to develop attacks for AI mobs in my game using new Structs, and this is the code I've ended up with(please let me know if there are any other problems except for the one I will explain below the code):
Then I've made the Child Function of that function to then apply this to the object in the game, I thought this would make the proccess of applying AI behaviour to the objects easier because they don't inherit the neccesarry variables from just the objects. But I've met the critical problem which made this proccess even impossible to test: When I write new Attack(...)
I just don't get the arguments names in the bottom (I've attached the screenshot showing this) , like I don't know what argument to enter even though I've made the function JSDoc description which usually works perfectly with normal functions. So what have I done wrong???
GML:
#region//Parent Attack
#region//Description
///@func Attack
///@arg inst
///@arg sprite
///@arg time*
///@arg cooldown(sec)
///@arg speed(1)
///@arg target(inst)
///@arg x_range
#endregion
function Attack(_inst,_sprite,_attack_time,_attack_cooldown,_attack_speed,_attack_target,_attack_x_range) constructor
{
attack_owner = _inst;
attack_sprite = _sprite;
attack_cooldown_time = _attack_cooldown * FRAME_RATE;
attack_target = _attack_target;
if(_attack_time!=noone && _attack_time!=-1)
{
AnimationSetLength(_sprite,_attack_time);
}
attack_speed = _attack_speed;
attack_cooldown = 0;
attack_cooldown_check = function(){
attack_cooldown+=attack_speed;
return attack_cooldown>=attack_cooldown_time
}
}
#endregion
//Dash Attack Function
//...
//...
I just don't get the arguments names in the bottom (I've attached the screenshot showing this) , like I don't know what argument to enter even though I've made the function JSDoc description which usually works perfectly with normal functions. So what have I done wrong???
Attachments
-
42.8 KB Views: 5