GameMaker Studio 2: RPG Starter Kit #3 – Movimento, Colisão e Distorção

Este vídeo aborda: – Mover o player pelas nossas salas – Fazer bom uso da camada Tiles_Collision – Fazer a câmera seguir o Player – Deslocar-se entre as salas e dentro das salas, com exemplos para a borda do mapa e escadas incluídas. Compre tudo aqui: ▶ A seguir: Battle! :

Discord: Patreon: Itch: Twitter:

Sprites de monstros:
[The “Silmar” tiles link already has the monsters separated]

Planos de fundo de batalha: Download de sprites de itens: GameMaker Rob’s Amazingly Awful Sprites: /8ero29b46fnc1yy/AABV-WBGqN1-ycTggpdR_D1Ya?dl=0

************************************************** ************************************************** * Este é um RPG baseado em turnos para GameMaker Studio 2 no qual cobrimos tudo, desde a criação de salas, autotiling, movimentação, deformação (viajar) de sala em sala, NPC’s, diálogo, missões, busca de móveis e baús por itens, salvamento, carregamento, áudio, um sistema de batalha baseado em turnos e algumas outras coisas também! Confira o Roteiro: ****************** ************************************************** ********************************* ====== Créditos ====== Animação de fundo por: AA VFX, Amitai Angor , Música: editado por GameMaker Rob


14 thoughts on “GameMaker Studio 2: RPG Starter Kit #3 – Movimento, Colisão e Distorção

  1. [Player sprites not animating properly?]
    I thought I'd addressed this in another post but I can't find it so here it is:

    If your player is not animating properly when moving left/right etc, wrap the four lines that set the player sprite to stationary in this "if" statement (ill post the whole block so you can copy/paste it):

    if (!global.HELD_D && !global.HELD_L && !global.HELD_R && !global.HELD_U){


    if sprite_index == spr_player_down_anim sprite_index = spr_player_down;

    if sprite_index == spr_player_up_anim sprite_index = spr_player_up;

    if sprite_index == spr_player_left_anim sprite_index = spr_player_left;

    if sprite_index == spr_player_right_anim sprite_index = spr_player_right;

    Basically we only want to be changing the players sprite to stationary if the player is NOT holding down any of the movement keys.

  2. oh, btw! How would you go on about making a running code?

    I tried this but sometimes it would work, sometimes it would make some stuttering of sorts

    if keyboard_check_pressed(ord("X"))


    stepSpeed = 4;

    image_speed = 2;

    is_running = true;

    is_walking = false;


    if keyboard_check_released(ord("X"))


    stepSpeed = 2;

    image_speed = 1;

    is_running = false;

    is_walking = true;


  3. Hello, Rob. Thank you so much for this series!
    You explain so much in so less time than many other tutorials. And it's exactly what I need for my game. I also wanted my player to move only 1 tile by press, which is uncommon to find in rpg tutorials.
    My only issue would be regarding collisions. Your code is fine but what I wanted is how to apply collisions to an object (ex: obj_wall) which I can manually place in the room instead of making it by tile layer. I tried applying a code but it didn't work and the player immediately got stuck when colliding with the obj_wall :/
    Any ideas on that?

  4. So at 10:52 when I run the game I get the errors: "Object: obj_init Event: Step at line 8 : unexpected symbol "else" in expression" and "Object: obj_init Event: Step at line 8 : malformed assignment"
    It shows that the error is something here:
    global.HELD_U = true;

    Removing that specific line for the up key causes the error to happen with the next line about the down key. I'm really confused.

  5. Hi Rob, thanks again for these videos. Have you checked out draw_sprite_part? If you haven't, it would allow you to draw and animate all movement and idle sprites for a player from one sprite file with just one frame. Keeps the sprite folder decluttered! This is especially helpful if you have multiple characters that will require movement and animation.

  6. Hello Rob! I adore this tutorial, trying to go through several others I believe this is the best for me. (I actually am very VERY excited to start your Isometric tutorial because I love that genre of game but I want to do this first.)
    I am having an issue, I can do the "stairs" warp like you have, where your character warps from once location within a map to another. Like, from the stairs in the house to the stairs behind the house in your rm_village
    BUT I cannot leave the map I start on. In fact, I've noticed I cannot spawn anywhere but in my Village.
    There is an instance of Obj_player in each place I'd like to travel to, I use the same set up for warping from staircase to staircase to room to room.
    If I go into obj_init and I change my starting room to rm_village, I spawn right where my player obj is placed. Perfect just like you showed. I can then, from there travel up and down my stairs within rm_village.
    If I try to take a warp tile to another room, let's say the rm_worldmap my output just reads

    "Entering main loop.

    and the game stops running. I can still see everything on the Village map but movement is disabled.
    If I go into obj init and change the starting room to rm_worldmap the game launches but I start in my village room on top of the warp tile that should bring me to the world map.
    If I change it to warp me to rm_dungeon the screen just goes to black. I never get any errors however.

    Another thing to add is rm_worldmap originally had no tileset set to the collision map, and it would tell me there was an error finding the id. Once I added the collision map that error vanished from my output to be replaced with the infinite loop. I'm going to move on to your combat tutorial and hope either I figure out the warp issue or you're able to help me with it. Thank you for taking the time to read this and reply.
    If you'd like to communicate in a location I can send you images please check @GalemontDev on Instagram. I'll happily message you from there as well.

  7. hey dude. My game works pretty fine up until 14:30 . For some reason if I put in the code for the camera my player doesn't move. Could you help and see what I might be doing wrong. Here's my player's movement code:

    #region MOVEMENT

    if(disabled == false){

    if(global.Held_L) && (canMove == true){

    targetX = x – 16;

    sprite_index = sLukeWalkingLeft;

    canMove = false;


    if(global.Held_R) && (canMove == true){

    targetX = x + 16;

    sprite_index = sLukeWalkingRight;

    canMove = false;


    if(global.Held_U) && (canMove == true){

    targetY = y – 16;

    sprite_index = sLukeWalkingUp;

    canMove = false;


    if(global.Held_D) && (canMove == true){

    targetY = y + 16;

    sprite_index = sLukeWalkingDown;

    canMove = false;



    if(canMove == false){

    var Target_X_Cell = floor(targetX / grid_size);

    var Target_Y_Cell = floor(targetY / grid_size);

    var tile_to_check = tilemap_get(map_id, Target_X_Cell, Target_Y_Cell);

    if tile_to_check > 0{

    targetX = x

    targetY = y

    canMove = true;



    if(x != targetX || y != targetY){

    x += sign(targetX – x) * step_speed;

    y += sign(targetY – y) * step_speed;


    canMove = true;


    if sprite_index = sLukeWalkingDown sprite_index = sLukeNotWalkingDown;

    if sprite_index = sLukeWalkingUp sprite_index = sLukeNotWalkingUp;

    if sprite_index = sLukeWalkingLeft sprite_index = sLukeNotWalkingLeft;

    if sprite_index = sLukeWalkingRight sprite_index = sLukeNotWalkingRight;




    #region CAMERA

    halfViewWidth = camera_get_view_width(view_camera[0]) / 2;

    halfViewHeight = camera_get_view_height(view_camera[0]) / 2;

    cx = x – halfViewHeight;

    cy = y – halfViewWidth;

    camera_set_view_pos(view_camera[0], cx, cy);


  8. A little late to the party but if you select object in a room there is a black strip under room editor window telling you that object coordinates. Great tut btw. Instant subscription 🙂

  9. Hi Rob,
    I have literally devoured every tutorial from Shaun and FriendlyCosmonaut. But bottom line, I think that your approach in many aspects of coding is the most accessible and straight forward. I love your coding style and will try to adapt it. 🙂

    Thank you for all your tutorials and your time.

  10. How did you get the sprites individually? I used the resources and I have a page with multiple directions of the character, im not sure how to separate them into game maker!

  11. mamacato >
    "Hi Rob, and everyone. If you're here and you've fixed the #macro GRID_SIZE 16 (removing the equal sign), then you should replace all values of 16 in obj_player to GRID_SIZE. :)"

    Me >
    – A silly mistake, sorry guys! (when making a macro, just type it as mamacato has done above)

  12. I've had a problem with this for a while which I've been unable to solve. The first time the game is loaded and I go onto a warp tile the game refreshes the room. If I go on the warp tile again I go into the room but instead of going to the desired coordinates the player remains where the object was originally placed in the room. Any help would be appreciated.

Deixe uma resposta

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