GameMaker Studio 2.3: FUNCTIONS! (+ Method Scope & Static Variables)

Поділитися
Вставка
  • Опубліковано 19 гру 2024

КОМЕНТАРІ •

  • @GameMakerStation
    @GameMakerStation  4 роки тому +6

    Thanks for watching! Make sure to join our Discord server if you want to discuss the new beta -- we've got #beta channels! discord.gg/TykHyqK

  • @AndrewOBannon
    @AndrewOBannon 4 роки тому +19

    Quarantine is making YOYOgames' team quite productive.

  • @Mk2kRaven
    @Mk2kRaven 4 роки тому +14

    You are starting to become my favorite GM UA-camr.

  • @timezerohour8864
    @timezerohour8864 3 роки тому

    Thanks for this. I had used GM1 and made a loot of small games in the past now I am having to play catch up with all the changes.

  • @rineddy
    @rineddy 4 роки тому +1

    Very interesting. These changes make GML more familiar.
    I'll give another chance to GM. :)

  • @aorn8437
    @aorn8437 3 роки тому

    as usual, another absolutely stunning tutorial

  • @stubz1369
    @stubz1369 4 роки тому +4

    So functions are like scripts, except they're easier to set up, organize, and pass arguments to? I'm only afraid of avoiding new features out of not knowing how much better they are. Helpful video!

  • @philosopherhobbs
    @philosopherhobbs 4 роки тому +3

    Great job! I was wondering how exactly the 'static' keyword is working in 2.3.

  • @mayathemaster
    @mayathemaster 4 роки тому +1

    Cant wait for the structs tutorial!!

  • @craigcashman2275
    @craigcashman2275 4 роки тому

    You are the best. YoYo games should give you a job.

  • @sabriath
    @sabriath 4 роки тому +5

    Woah, this is a huge overhaul.....will scripts need to be function wrapped after the change, or does it automatically detect that there is code in the script and assume the wrapping based on the name?

    • @Kezarus
      @Kezarus 4 роки тому

      That's an excellent question... o_O

    • @GameMakerStation
      @GameMakerStation  4 роки тому +9

      When you import an older project into 2.3, it automatically wraps all your scripts inside functions. And yes it uses the script name. So your functions don't break on import.

    • @Baleur
      @Baleur 4 роки тому

      @@GameMakerStation So if you write an "old" script when following a tutorial, you must create a new template project, paste the old scripts into that, then restart game maker, and "import" the new template project, hope the scripts get updated? LOL

  • @m1s3ry97
    @m1s3ry97 4 роки тому +6

    So, basically, now scripts will start to act like libraries in any other language? I mean, they can contain macros, static variables and functions, and they are initialized with the game rather than being called, so, pseudo library?

  • @darkknightleon9843
    @darkknightleon9843 4 роки тому

    Good job! Greatings from China

  • @jfurmann
    @jfurmann 4 роки тому

    I love your videos, thanks for your work!

  • @Baleur
    @Baleur 4 роки тому +4

    Im having a REAL pain in the ass trying to figure out how to convert pre-2.3 scripts from tutorials etc, to work in 2.3 =(

  • @chooby4405
    @chooby4405 4 роки тому +2

    Really informative!

  • @Baleur
    @Baleur 4 роки тому

    Can you do something like "static return RandomNum" to only get the writeout in the output log ONCE, rather than every frame?

  • @mythology100
    @mythology100 4 роки тому

    Can't wait for structs video.

  • @stdiogypsy
    @stdiogypsy 3 роки тому

    Hey man! So would it work to write the functions in global format like so: function global.GetName() , or is it only possible with global.GetName() = function() ?
    Thanks!

  • @sambaylus9912
    @sambaylus9912 4 роки тому

    A+! Thanks for the information

  • @dcddoucette7973
    @dcddoucette7973 4 роки тому

    My only question is, can I bind a global/script function to an instance using method()?

  • @evensteven4367
    @evensteven4367 4 роки тому

    what is your intro song

    • @GameMakerStation
      @GameMakerStation  4 роки тому

      One I made myself: soundcloud.com/gurpreet-singh-matharoo/gamemakerstation-outro-extended

  • @chrishoyle27
    @chrishoyle27 4 роки тому

    Do you know if the new functions still support the JSDoc comments?

    • @GameMakerStation
      @GameMakerStation  4 роки тому +1

      The global ones do. And we'll probably be getting optional argument support in JSDoc. This is great because the new named arguments support optional args, so if you don't pass in an argument, it doesn't crash, and simply makes it "undefined".

    • @chrishoyle27
      @chrishoyle27 4 роки тому

      Great news all round. Thanks for the answer.

  • @rightanglegames
    @rightanglegames 4 роки тому

    Nice info for those of us waiting for beta access ;-)
    Do functions work with object inheritance? Say I define a function GetName() in an object oCharacter and oPlayer and oEnemy both have oCharacter as their parent object. Is GetName() available in both child objects oPlayer and oEnemy and does it output the proper object name?
    That would be a real life changer and one could have inheritance of functions and write way better and more secure code...

    • @homunculus1984
      @homunculus1984 4 роки тому +1

      Yes, as long as you don't override the event defining the function, or call event_inherited inside of it

    • @rightanglegames
      @rightanglegames 4 роки тому

      @@homunculus1984 Thanks for the reply. That's a pity that overriding the event messes up the function declarations...So I better use some obscure event (user_15) and put all my functions to be inherited in there ;-)
      There really should be a clean way to write functions for objects that are working across all child objects and not be "corrupted" in any way. I want common method inheritance like in any other OO programming language (Java, C#, ...).

    • @homunculus1984
      @homunculus1984 4 роки тому

      @@rightanglegames The function declarations have to run, you can't just put them in a user event and never run it

    • @rightanglegames
      @rightanglegames 4 роки тому

      @@homunculus1984 Are you sure? They should be compiled before I start a game, like any other code for any event - so why should they have to run once? I'd guess the Compiler should do that job. Rethinking that even calling event_inherited() shouldn't mess functions up but should define the same functions (if not reusing them cause they didn't change) for the child object. Do you have the beta and could verify that? Or Matharoo?
      Otherwise it wouldn't make sense to me at all honestly...

    • @homunculus1984
      @homunculus1984 4 роки тому +1

      RightAngleGames I’m sure. Functions inside scripts do run before anything else, but methods (functions bound to instances or structs) need to run, they are like resources in this sense, they need to be created, they are not parsed on game start. Behind the curtains, doing function foo() {..} in an instance is like doing foo = function() {...}. You’re declaring a variable. And the variable starts to exist only at the time it is declared.

  • @hansp0
    @hansp0 4 роки тому

    Dowlord 2.3 ?

  • @celesteorsa3918
    @celesteorsa3918 4 роки тому

    This was a bit of a bane for my project! I had planned my game using scripts as code containers, so that i have all code organized in script folders, now i find "functions" in all scripts that i created! Sure, the game still works, but in every script page it generated whitespace before each string which I find very irritating.

    • @celesteorsa3918
      @celesteorsa3918 4 роки тому

      why put a small heart on my comment? what does it mean? you love me?

  • @krystofoxik
    @krystofoxik 4 роки тому

    Awesome content, love it! =)

  • @StephenLoney
    @StephenLoney 4 роки тому +1

    Good stuff!

  • @jk-gn2fu
    @jk-gn2fu 4 роки тому

    Function is a game changer. So need to create script files for small features anymore...

  • @grapeshott
    @grapeshott 4 роки тому

    Gamemaker becomes more rational

  • @hyeonsuha3137
    @hyeonsuha3137 4 роки тому

    GameMaker Studio 3

  • @p3hwn1e
    @p3hwn1e 4 роки тому

    :D Hell yes!

  • @harjiohrg3824
    @harjiohrg3824 4 роки тому +1

    ooooo okkkkk

  • @professionalquestion5415
    @professionalquestion5415 4 роки тому

    This is too much for a beginner like myself.