You can wrap an argument name in brackets to indicate that it is optional. When using Feather, you will see detailed information on the function when you hover your mouse over it: Note that both the optional "type" and the obligatory "description" parts of are not displayed by default in the IDE code complete, and to see them you must activate the options in the GML Preferences. In the image above, the top part shows the function in the auto-complete and the bottom part shows how the argument helper at the bottom works. Now, when calling this function anywhere in your project, you will see the new argument names that were entered in the JSDoc comments: Return _inst_id.object_index = _object_id The available identifiers are as follows: / full function name including / general description of what the function parameter / / on arguments, with an optional object_id The object index to be checked against.įunction is_same_object(_inst_id, _object_id) The comments themselves need to be given an identifier (preceded by " and content. You can alternatively wrap your JSDoc comments in /** . The format for a typical function header would be to have the function name, the description of the function, and then the list of the different arguments (parameters) that the function takes, making sure to start each line with a triple forward slash " ///" as that tells GameMaker to parse the comment as being JSDoc style. the line where the function's name is defined). The option is visible when your text cursor is placed on a function header (i.e. TIP You can generate these comments automatically using Feather's Quick Fixes menu (press / + Q or click the icon). These comments are used to tell the auto-complete feature how the function should be used and filled out in the script editor. I would appriciate a very simplified answer please as I have "the learning difficulties".If you wish your custom functions to have code completion and to show the required arguments in a specific manner in the code editor, then you need to add some JSDoc style comments. But I guess what i'm asking is how? And what do arguments do in Game Maker Studio 2? There is a brief decription in the comment for the script: move a towards b by an amount and not overshoot b. y = Approach(y, target_y, move_speed) x = Approach(x, target_x, move_speed) hp = Approach(hp, max_hp, heal_amount) speed = Approach(speed, max_speed, acceleration) Nice bcause it will not overshoot "b", and works in both directions Moves "a" towards "b" by "amount" and returns the result The video I linked above does briefly describe it and this particular script was featured in a video by the Shaun Spalding (Praise be upon him) but.I still don't get it.įor reference, here is the code/script i'm talking about: Usually i'm reluctant to copy and paste code as it doesn't feel like I did it and I don't feel like i've learnt it if I just take it. It was short and simple, but it used a pre-made script i'm not familier with. Found a few tutorials on it, but the one I settled for was this one. Today, I looked into have more advanced movement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |