Diablo style point and click movement [Game Maker Studio 2 | Basics]

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • This basics video tutorial shows you how to make a point and click movement in GameMaker Studio the easy way.
    You may have seen/played games like Diablo or Path of Exile or even a moba. All these use the same movement system: Point and click.
    So all you need to understand here is that gamemaker has such a function ready to be used. This move_towards_point function does basically one thing. It moves the object constantly towards a set direction with a speed value. So in theory when you set it up once, it will follow this movement into infinity, which I guess you don't want. You simply implement a breaking condition that sets the speed to 0 when set destination point is being reached. And that's pretty much it.
    Tilset by Sardonic CC0
    opengameart.or...
    Naked Dudette by RayaneFLX CC3 sa by
    opengameart.or...
    🎮 My free game Clunky souls:
    1up-indie2.itc...
    🎮 My commercial game Office Orc:
    1up-indie2.itc...
    💓 My assets:
    Get some assets at itch.io 1up-indie2.itc...
    📜 Udemy: www.udemy.com/...
    👑 Support me and get fresh game art and game maker projects every month: / 1upindie
    Follow me on:
    📸 Instangram: / 1upindie
    🐦 Twitter: / 1upindie
    💬 Discord: / discord

КОМЕНТАРІ • 41

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

    If I may suggest something:
    In the create event:
    // target position for movement
    target_x = x;
    target_y = y;
    // movement speed
    spd = 1;
    Then in the step event:
    // setting new target position
    if mouse_check_buttom(mb_left) { // or right, if you want no move with right buttom
    target_x = mouse_x;
    target_y = mouse_y;
    }
    // moving
    mp_potential_step(target_x, target_y, spd, false);
    This way not only is really easy to solve the problem with non-stop movement as well as avoid solid objects (like walls, other characters, pillars, etc)

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

      Yop, gute Idee.

    • @playkill51
      @playkill51 2 роки тому +1

      When I try to use this here, when my doll stops, it keeps "flicking" the image

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

    It works and it is simple. GG

  • @idedary
    @idedary 4 роки тому +7

    I was once experimenting with this type of movement, but i accidentally made it, that if you clicked while he was moving, it will create path. Like after he will get to the point B from A he will start walking to point C. The funny part is, that it sounds complicated and to achieve that you would need to want to do it. But i made it by accident with interrest to create simple point and click movement so i had to fix the problem, that looks like it was more complicated version of the thing i want to achieve. I did not use any advanced things, just point_direction to mouse. And i have no idea if i want to replicate it. My own discovered paradox.

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

      Well, you got urself a paradox. Can't say how you did it and what to do with that, but it was defently amusing to read your post!

  • @kainegeorge3700
    @kainegeorge3700 2 місяці тому +1

    I have tried everything in my power to get this circle to appear when I click. all it does is create one as soon as I run it in the top left corner. Any advice?

    • @1upIndie
      @1upIndie  2 місяці тому

      Hm, use an instance for the mouse, give it an image and put in the step event x = mouse_x; y = mouse_y;
      Hope that helps!

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

    Create
    // target position for movement
    target_x = x;
    target_y = y;
    // movement speed
    spd = 2;
    Step
    // setting new target position
    if mouse_check_button(mb_left) { // or right, if you want no move with right button
    target_x = mouse_x - 31;
    target_y = mouse_y - 30;
    }
    // moving
    mp_potential_step(target_x, target_y, spd, false);
    Draw
    /// @description
    draw_self();
    draw_circle(target_x + 30,target_y + 30,7,0)
    I can't get the white circle to appear under the player object.

  • @juanignacioleyenberger55
    @juanignacioleyenberger55 Рік тому +1

    nice tutorial man!

  • @Superiiorz
    @Superiiorz 2 роки тому +1

    Do you have any tutorial on how to make the player walk around an object if it is in the way of your direction?

    • @1upIndie
      @1upIndie  2 роки тому +1

      Yes, it is called -> ua-cam.com/video/RmOqnp5d33Q/v-deo.html. There are 3 videos on more and more complex solutions to this problem.

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

    No no noooo..... do Diablo Style INVENTOOORYYY

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

      In the future. Sure, why not.

  • @user-wp6qn9pq8g
    @user-wp6qn9pq8g 2 роки тому +2

    все конечно классно но как быть с хождением по 8 сторонам и анимацией к ним же?если прописать тоже самое по направлению сторон просто право лево вверх и вниз все получается ломаное то верх ногами идет то еще чего в общем спасибо но не получилось как надо

    • @1upIndie
      @1upIndie  2 роки тому

      Это было бы совсем не так уж плохо. Но найдите хорошие ресурсы по 8 направлениям в перспективе ISO. Сейчас это довольно редкий и старый стандарт, который больше не используется должным образом.

  • @johanohrem3637
    @johanohrem3637 2 роки тому +1

    Could you show how to do it for eight directions, i can't seem to get it right.

    • @1upIndie
      @1upIndie  2 роки тому +1

      You partiton you direction into 8 parts (video goes for 4, in line 19+) and depending on which direction you have, you set the correct sprite to the player.

    • @johanohrem3637
      @johanohrem3637 2 роки тому +1

      @@1upIndie Ok i got all the directions to work now except the in between zero degree angle, For some reason it won't register at all or replace all the sprites with the sprite for that direction.

  • @andro-
    @andro- Рік тому +1

    how do I do this but to walk on a grid?

    • @1upIndie
      @1upIndie  Рік тому

      Is this what you are looking for?
      ua-cam.com/video/_2agjqJ2pD8/v-deo.html
      ua-cam.com/video/74mbIVtEFNU/v-deo.html

    • @andro-
      @andro- Рік тому

      @@1upIndie yeeeahh, thank you, bro! you are the best gamemaker tutorial channel

  • @allaze-eroler
    @allaze-eroler 2 роки тому +1

    could you do the same tutorial but this time with gml visual?

    • @1upIndie
      @1upIndie  2 роки тому

      Mate, all gml code can be instantly transfered into gml dnd/gml visual (and back to gml), it is right click on the thing to be converted and viola!

    • @allaze-eroler
      @allaze-eroler 2 роки тому

      @@1upIndie ah? i didn't know it was possible, thank for the suggestion.
      edit: i just realize that you were actually being a bit rude to me.... and what you just told me to do doesn't work like it should be because all the code will be turned as execute code, that is not what i wanted...

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

    Hi 1 up Indie, recently I support you patron site, seems you are working in a well balanced and smooth graphical paltforms, but I´m lookin for an extensive tutorial of the save and load states. By any chance could you help me to make that function work on a game I´m working on, I have another small issues on my game on how to make work properly the life and continues functions.I see a message section on your patreon activated but I don´t know if it is for post public comments or inbox. Good luck with your channel 1up, you have very usefull assets.

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

      I am online now, come to discord so I can help you in real time. You are a patreon, so you get special priviledges, of course I will help you out.
      You can use the patreon message system, but let's face it. Thats system is not very efficient, it is like sending email. I prefer discord where everybody can join and talk to me or other members of the community in real time. Once again, patreons get a preferential treatment, which is only fair.

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

      Tons of Thanks. How can I enter on your discor. Do I have to register my own account ?.

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

      @@1upIndie ohh I see it, I´m configuring right now the discord app becuase the app doesn´t allow me to send messages until I install the app. ok I´m checking.

  • @semihkzlkeci6272
    @semihkzlkeci6272 2 роки тому +1

    Hey there - do you know someone who does the exact same thing, but with Drag 'n Drop feature?

    • @1upIndie
      @1upIndie  2 роки тому +1

      Not really, a good channel that does DnD is this one: ua-cam.com/users/Slyddarvideos

    • @semihkzlkeci6272
      @semihkzlkeci6272 2 роки тому

      @@1upIndie thanks, I've somehow managed to make character go where I want guessing what it could be by imitating what you're doing, but I can't make it stop and can't find what you did there :)

  • @kevinmalone9410
    @kevinmalone9410 2 роки тому +1

    How do i animate this?

  • @Superiiorz
    @Superiiorz 2 роки тому +1

    I am getting the error Variable obj_player.spr_Player_Up_Right(100015, -2147483648) not set before reading it.
    Can anybody tell me why this is happening

    • @1upIndie
      @1upIndie  2 роки тому +1

      Um, that simply means that you were assinging a variable called spr_Player_Up_Right a value, which should be in obj_player. But the error say that this variable doesn't exist in obj_player.

    • @Superiiorz
      @Superiiorz 2 роки тому

      Im pretty new to GML, how do i fix this?

    • @1upIndie
      @1upIndie  2 роки тому

      @@Superiiorz Well, I have no idea what you are trying to do, so it is hard to say how to help you. I would recommend to do some beginner courses to get slowly into coding.
      Your mistake here is (a hard guess) that you are trying to link something from one instance to another and that variable is not in the create event of the obj_player (it needs to be set there so you can actually use it).

    • @Superiiorz
      @Superiiorz 2 роки тому

      @@1upIndie I am trying to change sprite when the point direction changes same as in your tutorial