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
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)
Yop, gute Idee.
When I try to use this here, when my doll stops, it keeps "flicking" the image
It works and it is simple. GG
Ya welcome.
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.
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!
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?
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!
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.
nice tutorial man!
Thanks for watching!
Do you have any tutorial on how to make the player walk around an object if it is in the way of your direction?
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.
No no noooo..... do Diablo Style INVENTOOORYYY
In the future. Sure, why not.
все конечно классно но как быть с хождением по 8 сторонам и анимацией к ним же?если прописать тоже самое по направлению сторон просто право лево вверх и вниз все получается ломаное то верх ногами идет то еще чего в общем спасибо но не получилось как надо
Это было бы совсем не так уж плохо. Но найдите хорошие ресурсы по 8 направлениям в перспективе ISO. Сейчас это довольно редкий и старый стандарт, который больше не используется должным образом.
Could you show how to do it for eight directions, i can't seem to get it right.
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.
@@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.
how do I do this but to walk on a grid?
Is this what you are looking for?
ua-cam.com/video/_2agjqJ2pD8/v-deo.html
ua-cam.com/video/74mbIVtEFNU/v-deo.html
@@1upIndie yeeeahh, thank you, bro! you are the best gamemaker tutorial channel
could you do the same tutorial but this time with gml visual?
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!
@@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...
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.
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.
Tons of Thanks. How can I enter on your discor. Do I have to register my own account ?.
@@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.
Hey there - do you know someone who does the exact same thing, but with Drag 'n Drop feature?
Not really, a good channel that does DnD is this one: ua-cam.com/users/Slyddarvideos
@@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 :)
How do i animate this?
Animate what?
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
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.
Im pretty new to GML, how do i fix this?
@@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).
@@1upIndie I am trying to change sprite when the point direction changes same as in your tutorial