GameMaker Studio 2: Tutorial de RPG de ação (Episódio 34: Bombas)



★ Código fonte ▶ https://shaunjs.itch.io/shauns-action-rpg-tutorial ★ Playlist ▶ https://www.youtube.com/playlist?list=PLPRT_JORnIuosvhfax2TQTEmN7OYTcSvK ★ Apoie meu trabalho ▶ https://www. patreon.com/shaunjs ★ Assets & Sprites ▶ http://shaunspalding.co.uk/ARPG_Assets.zip (NOTA: clique com o botão direito do mouse e clique em “salvar como” se este link não funcionar, é um problema do Chrome) Aprenda a construir um RPG de ação tipo zelda no GameMaker Studio 2, começando do nada. Hoje implementamos bombas arremessáveis ​​what go boom. Esses tutoriais são quase totalmente suportados por pessoas maravilhosas via Patreon, clique no link acima para se juntar a eles e acessar esses episódios o mais cedo possível, obtenha acesso instantâneo ao código-fonte de todos os vídeos e muito mais.

source

36 thoughts on “GameMaker Studio 2: Tutorial de RPG de ação (Episódio 34: Bombas)

  1. Instead of typing that whole code where you hit all enemies only once again, you can turn it into a function.

    function HitSomething(collisionHistory, _damage, _knockback)

    {

    var _entityList = ds_list_create();

    var _entityCount = instance_place_list(x, y, pEntity, _entityList, false);

    for (var i=0; i<_entityCount; ++i)

    {

    //If this instance has not yet been hit by this attack, hit it!

    var _entity = ds_list_find_value(_entityList, i);

    if (ds_list_find_index(collisionHistory, _entity) == -1)

    {

    ds_list_add(collisionHistory, _entity);

    with (_entity)

    {

    if (object_is_ancestor(object_index, pEnemy))

    HurtEnemy(id, _damage, other.id, _knockback);

    else if (entityHitScript != -1)

    entityHitScript();

    }

    }

    }

    ds_list_destroy(_entityList);

    }

    oExplode step event:
    /// @desc Hit things

    if (!global.gamePaused)

    {

    image_speed = 1.0;

    if (image_index < 4)

    HitSomething(collisionHistory, 25, 20);

    }

    else

    image_speed = 0.0;

    function CalcAttack(_mask, _damage, _knockback)

    {

    //Use attack hitbox & check for hits

    mask_index = _mask;

    HitSomething(collisionHistory, _damage, _knockback);

    mask_index = sPlayer;

    }

    In function AttackSlash(), you have to use CalcAttack(sPlayerAttackSlashHB, 5, 10); instead of the original function call. This way the damage and knockback aren't hardcoded in.

    You don't have to pass along collisionHistory, but this way you can give the collisionHistory variable a different name. This only works with arrays and ds lists etc., not with regular variables. Those only go into the function and don't get changed outside of the function.

  2. if you're having an error with the with statement on line 16 of the step event of the oExplode its probably because you forget the _entityCount–; at the endish part of the code (that's the problem I had 😛

  3. Another Great tutorial!

    Just a quick thing, The List "collisionHistory" is only being destroyed when it's finished the animation, So the Player can potentially leave the room before it happens.

    It might be a good idea to delete the list when you're changing the room too!

  4. Here's that step event at 19:50

    if (!global.gamePaused)

    {

    image_speed = 1.0

    //HIT THINGS

    if (image_index < 4)

    {

    var _entityList = ds_list_create();

    var _entityCount = instance_place_list(x,y,pEntity,_entityList,false);

    var _entity = noone;

    while (_entityCount > 0)

    {

    _entity = _entityList[| 0];

    if (ds_list_find_index(collisionHistory, _entity) == -1)

    {

    with (_entity)

    {

    if (object_is_ancestor(object_index,pEnemy))

    {

    HurtEnemy(id,25,other.id,20);

    }

    else

    {

    if (entityHitScript != -1) script_execute(entityHitScript);

    }

    }

    ds_list_add(collisionHistory,_entity);

    }

    ds_list_delete(_entityList,0);

    _entityCount–;

    }

    ds_list_destroy(_entityList);

    }

    }

    else

    {

    image_speed = 0.0;

    }

  5. I have zero experience with coding of any sort, but I've worked through the Platform Tutorial and this ARPG Tutorial over the course of two weeks, and I actually feel comfortable working with GML now! Let it be said, I am absolute proof that someone who's never written a curly-bracket in their life can really learn something from this series. Hoping to start my own project after getting some practice with the mathematics side of things. You're doing the pixel Lords work.

  6. Code at 19:50:

    if (!global.gamePaused)

    {

    image_speed = 1.0;

    //Hit Things

    if (image_index < 4)

    {

    var _entityList = ds_list_create();

    var _entityCount = instance_place_list(x,y,pEntity,_entityList,false)

    var _entity = noone;

    while (_entityCount > 0)

    {

    _entity = _entityList[| 0];

    if (ds_list_find_index(collisionHistory, _entity) == -1)

    {

    with (_entity)

    {

    if (object_is_ancestor(object_index,pEnemy))

    {

    HurtEnemy(id,25,other.id,20);

    }

    else

    {

    if (entityHitScript != -1) script_execute(entityHitScript);

    }

    }

    ds_list_add(collisionHistory,_entity);

    }

    ds_list_delete(_entityList,0);

    _entityCount–;

    }

    ds_list_destroy(_entityList);

    }

    }

    else

    {

    image_speed = 0.0;

    }

  7. I love this series and thanks for keeping it going.

    I do have a question though: when moving diagonally, there is a slight "jitter" to the character. It's subtle and only exists when moving diagonally. I've checked the code quite a few times and was wondering if anyone had a fix. If you disable the running animation and use the idle animation it is incredibly noticeable. It might have something to do with sub-pixel movement but I don't know if you addressed at some point and I just missed it somehow…

    Thanks!

  8. hi I am making a game to game maker studio 2 I broke the game maker studio 2 and I want to uninstall it I just delete the game maker studio and I download it with and it is 'already install click ok to upgrade' and it is not working how to fix this plss tell me

  9. Hey I'm in episode 26 in this series and I still have a simple bug in my game and I don't know how to solve it. If I throw a pot slightly below grass, the grass sprite will be over the pot and not vice versa. Same goes for the slime enemy, my character sprite over rides the slime sprite even if I'm "behind" it

  10. Hi Shaun, I've been following the tutorial through and through as a 30 day project, learned a lot for someone who's never done coding before but I had a question, when enemies die if you run into them as they're dying they will sometimes damage you, is there any way around this?

  11. Hello, I'm currently on the third part, and my game always crashes after a full walk cycle to the right. It only happened after I updated my character sprite. The walk cycle has the same amount of frames for each cycle, I just cant figure it out.

  12. If anyone doesn't want to write the step event of oExplode, here it is –
    if (!global.gamePaused)

    {

    image_speed = 1.0;

    //Hit things

    if (image_index > 4)

    {

    var _entityList = ds_list_create();

    var _entityCount = instance_place_list(x, y, pEntity, _entityList, false);

    var _entity = noone;

    while (_entityCount > 0)

    {

    _entity = _entityList[| 0];

    if (ds_list_find_index(collisionHistory, _entity) == -1)

    {

    with (_entity)

    {

    if (object_is_ancestor(object_index, pEnemy))

    {

    HurtEnemy(id, 25, other.id, 20);

    }

    else

    {

    if (entityHitScript != -1) script_execute(entityHitScript);

    }

    }

    ds_list_add(collisionHistory, _entity);

    }

    ds_list_delete(_entityList, 0);

    _entityCount–;

    }

    ds_list_destroy(_entityList);

    }

    }

    else

    {

    image_speed = 0.0;

    }

Deixe uma resposta

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