Тёмный

Grid Based Navigation in GameMaker Studio - Tutorial 

Let's Learn This Together
Подписаться 11 тыс.
Просмотров 11 тыс.
50% 1

Опубликовано:

 

15 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@theblackkoopa2329
@theblackkoopa2329 3 года назад
Good video! You can make the grid much faster with some simple edits though. Instead of : mp_grid_create(0, 0, room_width, room_height, room_width / gridsize, room_width / gridsize); You could use: mp_grid_create(0, 0, room_width / gridsize, room_height / gridsize, gridsize, gridsize); This will severely reduce the size of the grid and therefore up the performance. This does mean your grid will consist of even squares instead of being offset by the room width and height (which will happen if neither of the values are equal) That said, I can't really think of why you'd want unequal cells instead of perfect squares. EDIT: Realized I messed some initial calculations up and readjusted for that. This is why you proofread BEFORE sending the message lol.
@startek119
@startek119 4 года назад
Commenting to support the channel. Pass it along.
@joshuah673
@joshuah673 4 года назад
Thank you so much! The video was really easy to understand and it worked perfectly the first time. :D
@RomainCourtois
@RomainCourtois 6 лет назад
Is there a way to avoid this sprite flickering when moving diagonal ?
@hikka_live1035
@hikka_live1035 6 лет назад
I've got a problem, my o_player is 64x64 px, and my o_solid is 64x64 px, and no matter what i put in cellwidth and cellheight in mp_grid_create, my player clips into a wall and even walks in paths that he can't fit (where path is 32px width only or even 16), any idea why this could happen?
@LetsLearnThisTogether
@LetsLearnThisTogether 6 лет назад
I'm not sure, no. It sounds like you're got fairly regular art assets, so it must be something with the code. Check out my source code from the description, and see if you've done anything differently. You could also try importing your sprites into my finished projects, to make sure it's not them.
@hikka_live1035
@hikka_live1035 6 лет назад
thank you for your response! i downloaded your already finished project and triend to do similiar thing with your assets, and player can walk right up the wall. Here a screenshot with red dot as origin point of the objPlayer imgur.com/a/zdrNA. And side note, in objGrid in the create event, mp_grid_create hcells and vcells shouldn't equal to room_width and room_height, because you're getting the 640 and 480 cells that are going past the screen and that's why fps heavily drops, I used in your project room_width/32 and room_height/16, fps = 1000+
@Feynman.R
@Feynman.R 6 лет назад
I have same problem. Did you find a solution?
@echopaff
@echopaff 3 года назад
Instead of declaring each individual object as an obstacle, could you have all of your objects be children of a parent object, and then just declare the parent object as an obstacle? That way you could add new objects to the room without having to go and declare it in the code?
@LetsLearnThisTogether
@LetsLearnThisTogether 3 года назад
Yep, that’s the most efficient way of doing it and the way I’d suggest once you understand inheritance.
@Chris-yj2di
@Chris-yj2di 5 лет назад
Hmm, followed along but the character I have just won't spawn a path and then follow it. I'll look into it some more. Thanks for the vids though!
@skyc4t68
@skyc4t68 3 года назад
Very useful!
@danielwisemangamedesign8425
@danielwisemangamedesign8425 5 лет назад
this works for me to a point. if i add more then one object to the grid the character doesnt move at all. if only one object is added then it doesnt work. Game Maker Studio 2 v2.2.2.413
@tobi-b
@tobi-b 7 лет назад
For some places it's better to just use invisible objects for walls
@juliuscarlnavales8432
@juliuscarlnavales8432 7 лет назад
How did u cut it out? Or move to another frame?
@Alex-rr1qc
@Alex-rr1qc 5 лет назад
I have the problem that the enemies overlap.
@zoeythebee1779
@zoeythebee1779 6 лет назад
Hi, in my project I want the A.I. to move on a grid. In chunks of 8 pixels (this may change to 16 in the future, I doubt it matters). And I don't want the A.I. to move diagonally. I have no clue how to do this and help would be great.
@LetsLearnThisTogether
@LetsLearnThisTogether 6 лет назад
A.I. movement on a grid is a pretty big process. What I'd suggest is making sure you understand this, and then look into the grids data structure. My idea is to combine the two, having each cell in the DS grid represent a movement space in your game, and then filling those in based on the grid you've created in your map. That's just the first idea that comes to mind, I'll think on it more.
@zoeythebee1779
@zoeythebee1779 6 лет назад
If it is really that complicated I'll just avoid it. I think I know how I could pull off what I have planned. Thanks anyways!
@thediamondtree4027
@thediamondtree4027 4 года назад
Hello, i have a question, when i do the exact same my unit doesnt move to the center of a new grid cell, how do i make it so it does? I have when i click some where the mouse_x becomes destinaitonx and same for the y, do i need to change this to something else?
@LetsLearnThisTogether
@LetsLearnThisTogether 4 года назад
What does happen when you set that?
@thediamondtree4027
@thediamondtree4027 4 года назад
@@LetsLearnThisTogether It goes to the exact point i clicked, so where my mouse was. But in the video and what i want is that it goes to the center of the grid cell. I guess that is defined in your guard when you clicksomewhere, but i cant find the video where you did that.
@LetsLearnThisTogether
@LetsLearnThisTogether 4 года назад
Hmm. I do believe there is a function to find the nearest grid x and y, so if you have the mouse x and y coordinates, you should be able to use those to get at what you want. I’m not sure which video it is where I do that though.
@dgreen6354
@dgreen6354 6 лет назад
Hi, can you explain. Let's imagine on soil player's spd is 2 for example, on road 3. How I can teach him to search way on road and use it, and what about doors in rooms using path how to
@LetsLearnThisTogether
@LetsLearnThisTogether 6 лет назад
Howdy. There are several ways to accomplish this, but the first that comes to mind is to lay down an invisible road object that the player checks to see if they're colliding with. If they are, change their speed to that roads speed. Other ways would be to check the sprites of the background, if you have that set up.
@dgreen6354
@dgreen6354 6 лет назад
would it be correct? set to road collide with player add spd += 2 create path for player from A to B check ich sec nearest road if find, create another path from player to road check nearest place from road to B create path on road to nearest place B check who faster path from player to B or from road to B choose right way and go for house we want to create path from pleayer to locked room (remember position in house) check this is house or just a wall if house find door create path from player to door move player use door, create another path from player near open door to position in house sorry for my English =\
@LetsLearnThisTogether
@LetsLearnThisTogether 6 лет назад
Something like that yeah. Although you'll probably need to be using collision checking functions, instead of the collision event, as that normally stops two things from colliding.
@iand6309
@iand6309 4 года назад
YOU FUCKING ROCK
@techiemay
@techiemay 4 года назад
Pardon me. I am attempting to use this type of grid movement, but my character is ignoring the added instances, and is walking through them. Is there a way I could get help for this?
@LetsLearnThisTogether
@LetsLearnThisTogether 4 года назад
You also have to add the instances to the grid with code, not just in the room. Have you done that?
@techiemay
@techiemay 4 года назад
Let's Learn This Together yes I have. If you have any complex answers go for it. I’m rather good in GML. I’ve just never touched any of this sruff
@LetsLearnThisTogether
@LetsLearnThisTogether 4 года назад
@@techiemay It's been a while since I have done anything with this, either. If you're adding it to the grid successfully, then check the sizing of it, if it needs to be solid or not, and the collision mask.
@techiemay
@techiemay 4 года назад
Let's Learn This Together what does solidity have to do with it? I’ve run the game a few times with solidity on and off and didn’t know if it mattered. Do they need to be in the room when they are added to the grid? They spawn in a few frames after the object is added to the grid.
@LetsLearnThisTogether
@LetsLearnThisTogether 4 года назад
I’m not sure if Solidarity is important, as I haven’t played with grids in a while. If you export or zip up your project and link it here or email it to me, I’ll check it out.
@ezravitto1034
@ezravitto1034 6 лет назад
PLEASE MAKE A NETWORKING TUTORIAL PLEASEEEEE LIKE PEER TO PEER NETWORKING USING UDP ON GMSUDTIO PLSSSS THANKYOUUUU
Далее
Source Control in GameMaker Studio 2 Tutorial
21:15
Просмотров 13 тыс.
Advanced Paths Functions in GameMaker Studio
17:21
Просмотров 15 тыс.
Doors Harpy Hare (Doors 2 Animation)
00:16
Просмотров 702 тыс.
😂😂
00:16
Просмотров 856 тыс.
The 15 Commandments of Game Maker
16:32
Просмотров 124 тыс.
Passing Vars Between GameMaker Objects (3 Strategies)
17:20
How can a jigsaw have two distinct solutions?
26:23
Просмотров 264 тыс.
The Basics of Paths in GameMaker Studio 2 - Tutorial
15:28
I Finally Played The "Rage Game" I WANNA BE THE GUY...
44:45
I Made the Same Game in 8 Engines
12:34
Просмотров 4,1 млн
Optimisation Tips | GameMaker Studio 2
19:10
Просмотров 50 тыс.
Blend Modes & Silhouettes | Game Maker Studio 2
31:52