GameMaker Studio 2.3 – Os scripts mudaram!



TL;DW: Os scripts costumavam *ser* funções, mas agora os scripts simplesmente *contêm* funções. Você pode colocar funções em qualquer lugar agora, mas se estiverem em scripts, são globais. Você pode nomear seus argumentos agora. Argument0 etc ainda funciona. Assim como script_execute. Mais detalhes diretamente do YoYo: https://help.yoyogames.com/hc/en-us/articles/360005277377 DIVIRTA-SE. ▶ Apoie meu trabalho: https://www.patreon.com/shaunjs

source

34 thoughts on “GameMaker Studio 2.3 – Os scripts mudaram!

  1. function PlayerStateRoll(){

    //Movement

    hSpeed = lengthdir_x(speedRoll, direction);

    vSpeed = lengthdir_y(speedRoll, direction);

    moveDistanceRemaining = max(0, moveDistanceRemaining – speedRoll);

    var _collided = PlayerCollision();

    // Update Sprite

    sprite_index = spriteRoll;

    var _totalFrames = sprite_get_number(sprite_index)/4;

    image_index = (CARDINAL_DIR * _totalFrames) + min((((1 – (moveDistanceRemaining / distanceRoll)) * _totalFrames)), _totalFrames -1);

    // Change State

    if (moveDistanceRemaining <= 0)

    {

    state = PlayerStateFree;

    }

    if(_collided)

    {

    state = PlayerStateFree;

    ScreenShake(4,30);

    }

    }

  2. function ScreenShake()

    {

    /// @desc ScreenShake(magnitude,frames);

    /// @arg Magnitude sets the strentg of the shake (distance range)

    /// @arg Frames set the length of the shake in frames (60 = 1 seconds)

    with (global.iCamera)

    {

    if (argument0 > shakeRemain)

    {

    shakeMagnitude = argument0;

    shakeRemain = shakeMagnitude;

    shakeLength = argument1;

    }

    }

    }

    function PlayerStateRoll(){

    //Movement

    hSpeed = lengthdir_x(speedRoll, direction);

    vSpeed = lengthdir_y(speedRoll, direction);

    moveDistanceRemaining = max(0, moveDistanceRemaining – speedRoll);

    var _collided = PlayerCollision();

    // Update Sprite

    sprite_index = spriteRoll;

    var _totalFrames = sprite_get_number(sprite_index)/4;

    image_index = (CARDINAL_DIR * _totalFrames) + min((((1 – (moveDistanceRemaining / distanceRoll)) * _totalFrames)), _totalFrames -1);

    // Change State

    if (moveDistanceRemaining <= 0)

    {

    state = PlayerStateFree;

    }

    if(_collided)

    {

    state = PlayerStateFree;

    ScreenShake(4,30);

    }

    }

  3. I'm going to try this with one of your tutorials. It feels like the script name is now almost a folder for a collection of similar functions, and in the scripts you set up/program the functions. Then you call them in an object with that script_execute(); bit.

    Hoping I got that right.

    I like the var func variation too.

  4. this was an extremely frustrating update I have no idea how or why I see so many comments saying this is easier now.

    my scripts only work when I write the arguments above the function in the old way and then write the code I want inside the brackets of the function.

    whenever I put my arguments in the parenthesis, the script does not run correctly (or not as I would expect it to run) but it will actually show my arguments in the bottom tool tip. this was made even more confusing when I would write my arguments the old way and see them work correctly when I run the game, but in my code I would get a warning saying I have 0 arguments even though when I run the game it works as expected so I have just learned to ignore those warnings. and the gap between figuring out that my code was actually running correctly with the old arguments was not fun to figure out.

    maybe Im still doing something wrong but idk because now my code is working the way I want.

  5. Thanks for this easy to understand explanation. It makes sense now why they made this change. Like, if you have an RPG with 20 unique items- you used to have to write 20 individual scripts. Now you can have one script that holds 20 functions. Plus, I like how quick and easy it is to declare arguments now, especially for writing long complicated functions where you used to have to keep track of what argument represented what.

  6. absolute beginner here, starting from Ep1 of the platformer tutorial and running into issues. I know I've got the discord and the subreddit to go to, and I probably will, but it's damn discouraging. :(======= It's not your job to supply the "total newb" with a list of potential landmines in laments terms, and I wouldn't hold you to it. It'd be nice if GMS did; and if they did, and I missed it, I'd love to read it.

  7. Coming from the second episode, I've been having this issue where my game crashes after a few seconds of running correctly (movement, animation) with just this –
    "FAILED: Run Program Complete
    For the details of why this build failed, please review the whole log above and also see your Compile Errors window."
    There's no compile errors however. I'm unsure if this is an issue with the update, as changing the runtime doesn't seem to help. I do literally have the same PlayerAnimateSprite script as instructed in the video, just wrapped into the function{}. Consider that it works fine before crashing (which can be within a second, 10, or when going into fullscreen/moving the window) I'm unsure of where I'd go hunting the issue. Thanks in advance for any advice!

  8. My game wont launch, it just says
    "[Run] Run game
    Options: Z:/Bellend_F2F4E2D7MainOptions.json
    X://windows/Runner.exe -game "Y:/Bellend_4AFCAC2_VMBellend.win"
    Attempting to set gamepadcount to 12
    DirectX11: Using hardware device
    Collision Event time(microsecs)=2
    " and doesn't launch.
    Please help.

  9. Finally a step to make GMLmore like a usable language. This is moving in a direction that I thought it should the first time I saw GameMaker and GML. I'm hoping to see function arguments (ok that came later in the video) soon too and perhaps strongly typed variables and function overloading.

  10. Thanks for all the hard work !

    I'm writing this comment to seek some help, since moving on to 2.3, my game crashes every time I loop my facing right running animation. I'm guessing that localFrame -= _totalFrames; ends up being equal to 0 and crashes the game, however, I can't seem to find a way to solve this without ruining the rest of the code (Although I checked, my PlayerAnimateSprite script is identical to Shaun's one).

    I have been tinkering with it for days, but no luck. It's frustrating because I want to continue following the tutorial, but it will be hard when I can't even go right properly. Can someone would be kind enough to help me ? Thanks !!

  11. can you make a video with new tips and tricks for many of the new features for GM2.3? Like best scenarios to use the new data structures like actual multi dimensional arrays, structs, the try and catch? is it better to work gml now like a roided javascript?

  12. if that is game maker studio 2 desk top Where it had pass words. I refunded the game. It was my fault for writing pass word on paper where it can get lost but now i have a code book for all passwords and dates i put them on sorry to say i have no money to rebuy game but i will when i do.
    mean while went back game studio 1.4 i did finish 1st level asteroids using images but worked great.

  13. Thanks so much for this timely update. I was going through your ARPG tutorial, and the script wasnt working. it may be worth updating the description on those videos with this update referencing this vid.
    GG

Deixe uma resposta

O seu endereço de email não será publicado. Campos obrigatórios marcados com *