[GameMaker Tutorial] Enemy AI Maze Pathfinding

  Рет қаралды 104,816

Heartbeast

Heartbeast

Күн бұрын

Check out my popular GameMaker Book and GameMaker Courses: www.heartbeasts...
Follow me on Twitch for GameMaker livestreams: / uheartbeast
Follow my twitter: / uheartbeast
Like my Facebook page: / heartbeast.studios
Follow me on Tumblr: / uheartbeast
Thank you all so much for your support!

Пікірлер: 357
@NikorasuChan
@NikorasuChan 9 жыл бұрын
GUYS IMPORTANT!!! HeartBeast forgot to destroy the path variable at the end. If you don't destroy it, it will cause memory leak! Just put this at the Room End: path_delete(path); Thank me later ;)
@uberalex5437
@uberalex5437 9 жыл бұрын
Thanks I'll remember this
@Revalopod
@Revalopod 8 жыл бұрын
+Nikorasu Chan (Nichii) what is room end?
@Revalopod
@Revalopod 8 жыл бұрын
+Nikorasu Chan (Nichii) I guess you didn't watch 9:15 then
@NikorasuChan
@NikorasuChan 8 жыл бұрын
+DeathSwagga He only destroyed the grid, not the path.
@uberalex5437
@uberalex5437 8 жыл бұрын
+Nikorasu Chan (Nichii) So within the same event as 9 15 put path_delete(path)?
@moshimooshi
@moshimooshi 9 ай бұрын
your channel deserves the world, man
@blabla5021
@blabla5021 8 жыл бұрын
12:12 he discovered the answer of the life, the universe and the rest lol
@theternal
@theternal 6 жыл бұрын
It is Vietnam flashback
@oldschewl
@oldschewl 8 жыл бұрын
This is exactly what I was looking for - a no frills introduction to GMS's pathfinding. My most humble thank you!
@helloofthebeach
@helloofthebeach 7 жыл бұрын
I've been banging my head on this on and off for months, and continued to bang my head with this tutorial since things just weren't working...but I finally got it! Thank you for helping me finally get my head around pathfinding.
@DanBraithwaite
@DanBraithwaite 8 жыл бұрын
Mate I dunno if you read these but I wanna say this was really helpful, and worked a charm. You're also a cool guy!
@DakNJaxter
@DakNJaxter 4 жыл бұрын
I did this in GMS2, and the the collision detection is set to the centre point rather than being pixel accurate, and its causing the enemy to overlap with the walls which looks bad. Do you know how to fix that?
@lanelauhoff
@lanelauhoff 9 жыл бұрын
Being able to see you explain the code helps me a lot, man, thanks! Looking forward for more tutorials!
@WolfySnackrib666
@WolfySnackrib666 8 жыл бұрын
HeartBeast seem to me like the kind of guy that practices meditation. Waaay calm and zen bru.
@dirtroadgames1406
@dirtroadgames1406 8 жыл бұрын
+WolfySnackrib666 haha yeah i think i would be insulting in front the pc screen if i miss something in a vide for youtube
@WolfySnackrib666
@WolfySnackrib666 8 жыл бұрын
Dirtroad Games Haha yeap. And then reshoot the whole thing, as a perfectionist :P
@dinohorseaborus
@dinohorseaborus 9 жыл бұрын
Wow ben! this tutorial is "AI-maze-ing!"
@uheartbeast
@uheartbeast 9 жыл бұрын
dinohorseaborus Nice haha
@vertox4837
@vertox4837 6 жыл бұрын
amAIzing
@th3r3ap3r2
@th3r3ap3r2 6 жыл бұрын
super nice
@RedstoneAnimatesandmore
@RedstoneAnimatesandmore 6 жыл бұрын
Ayyyyy......
@omikronweapon
@omikronweapon 8 жыл бұрын
Nice one as usual Benjamin, thanks. I like the synopsis at the end, just to review.
@Jakkisle
@Jakkisle 9 жыл бұрын
This is amazing, I didn't think something like this would be possible with so little code! You've helped me so much, thank you!
@drsquash2003
@drsquash2003 4 жыл бұрын
working in GM Studio 2. My enemies are "cutting" corners in a "smooth fashion". As if the corners of the walls are rounded. But I set diagonal motion to false, and triple checked; the collision masks are all square.
@ericfangrow743
@ericfangrow743 7 жыл бұрын
billy mays here baxck with another GREEEEEAAAAATTTTT PRODUUUUCCCCTTTT
@habarvaz
@habarvaz 6 жыл бұрын
This tutorial was great. Easy to use and to the point. Thank you!
@NorthStateGames
@NorthStateGames 6 жыл бұрын
Phenomenal work. Glad I bought your book too!
@colingreenall5049
@colingreenall5049 8 жыл бұрын
Can you do a tutorial to demonstrate how multiple enemies can avoid each other and not overlap?
@creasu124
@creasu124 8 жыл бұрын
maybe do if the enemy collides with it selfs x =xprevious and y = yprevious
@liamborella8977
@liamborella8977 7 жыл бұрын
Nope, then when the enemies collide they just stand there and don't move.
@violenceisfun991
@violenceisfun991 7 жыл бұрын
i know this is an old comment but if anyone else is still having this problem, try this out: on the enemy object, make a collision event for colliding with itself, and put this code in : { if id > other.id { x+=1; y+=1; } else if id < other.id { x-=1; y-=1; } } ^^this code will make it so that they move diagonaly away from each other if they touch
@liamborella8977
@liamborella8977 7 жыл бұрын
+Violence Is Fun another thing you could do is just use the 'step avoiding' event in the drag and drop, make the enemies and the wall solid and set the avoid tab to solid as well. It worked like a charm for me, and there wasn't all that setup
@violenceisfun991
@violenceisfun991 7 жыл бұрын
Liam Borella, ah cheers, i always forget about using drag and drop in gamemaker. i shall have to give that a try.
@codytremblay6513
@codytremblay6513 8 жыл бұрын
how do i add more then 1 instance. I tried just placing it under but the enemy went right through
@MyNameIssaSimon
@MyNameIssaSimon 7 жыл бұрын
How can I use this with gamemakers physics engine? My enemies stop if I active physics on them.
@naptan7866
@naptan7866 7 жыл бұрын
I've seen your courses on udemy. Your awesome. I might buy your course. keep going.
@kroutonjr
@kroutonjr 8 жыл бұрын
trying to incorporate this with your rts tutorial... right now i am having and issue where it will sometimes go through the objects but about 90% of the time it will find a way around my object. this is also in my step event for my unit as thats where the move state is in if (state == 'move') { scr_wizard_move() if instance_exists(target) if (mp_grid_path(global.grid, path, x, y, target.x, target.y, 1)) { path_start(path, spd, path_action_stop, false) }; }
@Kezarus
@Kezarus 9 жыл бұрын
Man, this is awesome! Definetly going to use it on my next RPG game. Thanks!
@uberalex5437
@uberalex5437 8 жыл бұрын
How can I make it so that the enemy following the grid collides with other enemies instead of overlapping?
@XDRosenheim
@XDRosenheim 8 жыл бұрын
enemy->collision->enemy - Step event - Empty code.
@antuankerbage
@antuankerbage 8 жыл бұрын
No.. The code would be like this or similar. mp_grid_clear////0 with (obj_parent) { if id != other.id { mp_grid_add_cell(....)///1 } }
@antuankerbage
@antuankerbage 8 жыл бұрын
Or when character moves, mark 1 in the coords to walk in the grid and then a 0 in the previous coords
@uberalex5437
@uberalex5437 8 жыл бұрын
there would only be an empty code if I'm using physics but I'm not. I used 'if other.x > x { x += 1; }' etc.
@antuankerbage
@antuankerbage 8 жыл бұрын
Use mp_grid (is the best option for me) or, another example... if !instance_place...
@dirtroadgames1406
@dirtroadgames1406 8 жыл бұрын
amazing tutorial my friend,exactly what i was needing,cheers
@KB_United
@KB_United 8 жыл бұрын
I'm in the process of learning how to make a top down shooter. I programmed a modified version of Shaun Spauldings collision code for platformers so it would work with my Top down shooter. I have a 3 burst machine gun and I can't wait to implement this when I get my enemies into the game. 😁
@glxxm
@glxxm 7 жыл бұрын
For those having difficulty, try making sure it's a global mouse click. This is working for me in GMS:2.
@ChrisRid
@ChrisRid 2 жыл бұрын
This is awesome, thank you! So easy to quickly add AI into the game.
@ikonhero
@ikonhero 6 жыл бұрын
Question, is it also possible to use a tile-based pathfinding system, so without having to set wall objects? For instance, when u create generated map using wall and floor tiles.
@EdoPlayer37
@EdoPlayer37 9 жыл бұрын
Thank you very much. I've been looking for this for a while now and you explained it really good.
@uheartbeast
@uheartbeast 9 жыл бұрын
Edo Player Glad I could help :D
@guigrillo101
@guigrillo101 9 жыл бұрын
Once I try to use this method but the enemy was intersecting a bit with the wall. I'm not sure why, but I started to use an a* extension.
@steview77
@steview77 9 жыл бұрын
When I do this the enemy crosses over the walls too, unless I set wall to solid then they just get stuck! Cant get the enemy to just avoid the wall!
@DFILL450
@DFILL450 8 жыл бұрын
+guigrillo101 Is your enemy sprite centered?
@cheezysqueezy
@cheezysqueezy 9 жыл бұрын
Nice tutorial! Thanks a lot!
@dinobudic4492
@dinobudic4492 6 жыл бұрын
Great video. I would like my enemy to navigate on dynamic objects. Example : Player casts nova spell and it creates few ice walls around him that should block the way. Should I just then update the grid ? What's the best way to detect new added "walls"?
@kankykune6459
@kankykune6459 8 жыл бұрын
I've tried to figure this out on my own but what do I type instead of (mouse_x div 32)*32+16; if I want the object to follow obj_player?
@kyle4760
@kyle4760 7 жыл бұрын
this doesnt work they completely ignore walls added to the grid
@jasonp7091
@jasonp7091 3 жыл бұрын
obj_player.x and obj_player.y are the (x,y) coordinates for your player
@sully9088
@sully9088 8 жыл бұрын
You are the best my friend.
@juliusherrmann1054
@juliusherrmann1054 9 жыл бұрын
Thats really ggod because I needed it for my game! Thank you!
@uheartbeast
@uheartbeast 9 жыл бұрын
Julius Herrmann Glad I could help
@RKCYOUTH
@RKCYOUTH 5 жыл бұрын
thank you so much for this amazing tutorial
@sheeplavender3261
@sheeplavender3261 6 жыл бұрын
Gms2 trial version doesn't allow for Path_Add
@wipedowt
@wipedowt 9 жыл бұрын
awesome tutorial HeartBeast, interested to know how the A* Algo could be used in a platformer scenario where players and enemies need to take into consideration obsticles (obj_wall) and gravity + jumping. would you perhaps be able to create in the future a tutorial like this? Thanks!
@KB_United
@KB_United 8 жыл бұрын
So what is the point of creating a variable call path and putting it equal to path add? I understand it all the way up until that point and then i see that and dont see a point to the path variable.
@biggriz7161
@biggriz7161 6 жыл бұрын
Cheers! Great tutorial.
@jasonjewik4349
@jasonjewik4349 8 жыл бұрын
My enemy partially phases through walls sometimes. I followed this tutorial exactly with the only exception that I made the enemy chase a player object. What is wrong?
@ikonhero
@ikonhero 6 жыл бұрын
Awesome! thanks for the video.
@LiamDoesProgramming
@LiamDoesProgramming 9 жыл бұрын
Is there a way to do this with ds_grids? so I can combine this with the Random World gen tutorial
@purpleice2343
@purpleice2343 9 жыл бұрын
+LiamDoesProgramming Why not just make two grids? Generation grid won't ever be used again after it generates the world anyway... Unless you want it to be infinite, well still, you won't be generating all the time, pathfinding will be used more.
@aliyarahmanajihati708
@aliyarahmanajihati708 7 жыл бұрын
when I add more than 1 enemy, obviously all of them will move toward the Player once the Player get into the range "to be detected" by one of the enemies. How do I make it so that it's only that certain Enemy (that the Player approach) to chase after the Player, not triggering all Enemies?
@LukeAps
@LukeAps 5 жыл бұрын
This is excellent, thanks HeartBeast. I wish you would do a new video on this for people looking for GMS2 ( Even though this is still compatible. )
@SubWolfIV
@SubWolfIV 2 жыл бұрын
You saved me! Thanks so much!
@cryodoctor7713
@cryodoctor7713 5 жыл бұрын
+HeartBeast How could you adapt this for a platformer like with gravity and such
@loganbevans4347
@loganbevans4347 5 жыл бұрын
Hey How would i go about adding this to a game where the room is expanding as i move around
@Peckan
@Peckan 8 жыл бұрын
Would it be possible to spawn the enemy object into the room and have it path towards another object instead of the mouse? I'm thinking along the lines of a Tower Defense game where the path changes depending on how the player decides to place their towers. Also if there are anymore great tutorials relating to TD games, let me know please!
@vinzhu3893
@vinzhu3893 8 жыл бұрын
Is there an option to remove an object from the grid? My player can destroy the walls so I want the enemy to be able to go through the space where the walls used to be.
@sdaqs2333
@sdaqs2333 7 жыл бұрын
you probably figured this out but you could update the grid each time (You would need to destroy the other to avoid a memory leak)
@nicholasrusciano5523
@nicholasrusciano5523 6 жыл бұрын
Is it possible to do this in the Standard Edition of Gamemaker? Its not recognizing some functions...
@gaurdian0digger
@gaurdian0digger 9 жыл бұрын
To go along with this video, could you also go over some of the maze/dungeon creation algorithms?
@uheartbeast
@uheartbeast 9 жыл бұрын
gaurdian0digger I shared a useful video on that a few days ago. Let me see if I can find it for you: kzbin.info/www/bejne/rZOZpmWAftKmr6c
@kryptkeeper2303
@kryptkeeper2303 9 жыл бұрын
would this work with the AI we made for the Slimes in the Rpg beginner series? if so how do i set it up
@BeanBunnyBass
@BeanBunnyBass 7 жыл бұрын
Is there a way to make an object follow a precise path through code?
@jiaska3889
@jiaska3889 6 жыл бұрын
Would I need to recreate the grid between rooms? Or change the values on room start?
@codingprinting3dandcnc191
@codingprinting3dandcnc191 3 жыл бұрын
Easy follow, thank you!
@MsAkbar14
@MsAkbar14 5 жыл бұрын
hi, how can i do this if my wall is mask with tiles collision mask?
@Baconlovar
@Baconlovar 8 жыл бұрын
omgosh this is amazing ty so much
@sachonski
@sachonski 8 жыл бұрын
Hey, great tutorial, but how would you aproach a everchanging enviroment? Meaning you have to create and destroy the grids for new results in the pathfinding?
@stijnd.6320
@stijnd.6320 8 жыл бұрын
+sachonski You can add and delete objects from the grid with: mp_grid_clear_all and mp_add_instances
@marcosandrade9074
@marcosandrade9074 7 жыл бұрын
Hello guys! I wonder if there is any way to find a path at an X / Y point. Something like the instance_position, which returns true if a path were located in the inserted coordinates. I looked in the documentation but found nothing about it. The two functions (path_get_x / path_get_y) however they show the value of X / Y already inside the path. Thank you all!
@TheMrPopper69
@TheMrPopper69 6 жыл бұрын
Amazing, thank you so much
@ericfangrow743
@ericfangrow743 7 жыл бұрын
when I try to do this it gives me an error message in line two of the grid object, the equal sign is unexpected. any reason why?
@temps1959
@temps1959 7 жыл бұрын
How would i change the xscale based on where he is going? Please help.
@lildgamedev6885
@lildgamedev6885 5 жыл бұрын
great tutorial thanks heartbeast!! now any idea how I can give the enemies collision with eachother on top of this pathfinding? If i added the obj_enemies to the grid like we did the walls, they cant move at all because it's checking for its own instance I think.
@DeadManRising36
@DeadManRising36 3 жыл бұрын
Could you do a tutorial about self learning algorithms?
@masterrender
@masterrender 8 жыл бұрын
owesome could you help me id like using sprite idle animation and it with walking jumping and so on. so may you to give the code where the enemy searcing by walking trough the wall and jump to find player
@Chuckyboy311
@Chuckyboy311 9 жыл бұрын
I know this isn't related but I couldn't find anything on it and I've learned the most from you so here we go. Would you be able to/ willing to make a tutorial on skill trees, and also like a level cap of sorts? I've tried a few ways but couldn't get any results.
@uheartbeast
@uheartbeast 9 жыл бұрын
Chuckyboy311 Hmmm, that sounds like it might take some thought for sure. I'll have to think about how I might teach that best.
@Chuckyboy311
@Chuckyboy311 9 жыл бұрын
HeartBeast Cool, thanks for the reply man
@pivotguy
@pivotguy 9 жыл бұрын
wow been along ime since i wach one of your vids(probably because i switched to unity3d) but sill good tutorial
@Oliwarder
@Oliwarder 8 жыл бұрын
if my obj_player collisiob with obj_wall, obj_enemy stops how know how to fix this?
@pipulese1775
@pipulese1775 8 жыл бұрын
How would you go about adding collisions with multiple enemies or moving entities with a grid system?
@MrTheDlanor
@MrTheDlanor 4 жыл бұрын
For anyone else wondering and still stuck a few years down the line: pathList = []; //need to store paths so they can be deleted later var i; for (i = 0; i < instance_number(obj_enemy_base); i += 1){ enemyIds[i] = instance_find(obj_enemy_base,i); pathList[i] = path_add(); show_debug_message("creating path " + string(pathList[i])); enemyIds[i] .path = pathList[i]; } Then delete with: var i; for (i = 0; i < array_length_1d(pathList); i += 1){ path_delete(pathList[i]); show_debug_message("deleting path " + string(pathList[i])); } where appropriate for your code.
@TheFlameincchannel
@TheFlameincchannel 9 жыл бұрын
Hey Ben, I am trying to use the path finding with an RTS system it works but, the characters move up and down and around very violently which seems weird, can you supply a solution.
@TheFlameincchannel
@TheFlameincchannel 9 жыл бұрын
TheFlameincchannel ***** HeartBeast Instead of a grid will I need to use mp_linear functions followed by mp_potential functions? If you have a solution, reply and I will contact you personally.
@cernos7230
@cernos7230 8 жыл бұрын
Will it lag if there are..let's say 500 AIs? each have different paths?
@Keizor1997
@Keizor1997 7 жыл бұрын
Great, it worked, thanks!
@gekkyt
@gekkyt 6 жыл бұрын
How do I change pathfinder from following mousex and y to following the players constant coordinates?
@AnEnormousNerd
@AnEnormousNerd 6 жыл бұрын
replace mouse_x and mouse_y to object_player.x and obj_player.y If your player object isn't called object_player, alter that as necessary.
@jackthake7209
@jackthake7209 8 жыл бұрын
will it still work if you put the grid code in a script and have the enemy run that script?
@fivoscapone9377
@fivoscapone9377 8 жыл бұрын
probably
@Hatmaster
@Hatmaster 9 жыл бұрын
So if I use this in a desktop defender type game, where you can place towers and the enemies have to update their path whenever you do so, is it going to lag badly?
@jaimied.5417
@jaimied.5417 9 жыл бұрын
You would probably have to delete the current grid and add more "wall" objects. Otherwise, that is a great way to use this algorithm. :D
@uheartbeast
@uheartbeast 9 жыл бұрын
No you should be fine. Just update the grid and paths with each new placed tower :)
@davidhoracek8937
@davidhoracek8937 9 жыл бұрын
Awfulmasterhat Just a little tip if you don't know it yet. Use 'mp_grid_add_cell()' for new towers... it's a lot faster than deleting grid and adding all the towers etc again. You just have to calculate a position of that cell... X and Y indices which is just X, Y div wcell, hcell (if you start grid at [0, 0]). On the other hand... if you... lose/destroy any tower use 'mp_grid_clear_cell()'... same as above but it marks that cell as free in your grid.
@Hatmaster
@Hatmaster 9 жыл бұрын
David Horáček Thank you!
@rellosorrell9265
@rellosorrell9265 9 жыл бұрын
I actually seem to have this working with the Random Levels right now. I know it's not terribly optimal, but there's always time for amendments later. Okay, so in the level creating object from the other videos, I created the MP_GRID stuff *at the bottom, after where I handle the walls and enemy spawns*. For me, it's global.mpgrid = mp_grid_create(0,0, LEVEL.width, LEVEL.height, CELL_WIDTH, CELL_HEIGHT); mp_grid_add_instances(global.mpgrid, obj_test_wall, false); Then, at the segment where you declare where walls are placed, I added a line to create the wall objects. For example: if (grid[# xx+1, yy] != FLOOR) {grid[# xx+1, yy] = WALL; instance_create(((xx+1)*CELL_WIDTH),(yy*CELL_HEIGHT),obj_test_wall);} This seems to be working throughout a few dozen maps so far. Just make sure to have your walls' opacity to 0!
@rellosorrell9265
@rellosorrell9265 9 жыл бұрын
The only issue is that I cannot get the collision detection to work quite right with the enemies. Probably due to the tileset sizes and the object sizes not quite being right.
@Parlakotta
@Parlakotta 7 жыл бұрын
Is there a way that instead of the enemy avoiding the walls while moving, it went over those walls as if they were a path, a street or something similar
@jasonp7091
@jasonp7091 3 жыл бұрын
Just have the walls outline the space you want your enemy to follow
@tuckertcs
@tuckertcs 8 жыл бұрын
wow that was easier than I thought it'd be :)
@panagiotisiatrou6041
@panagiotisiatrou6041 8 жыл бұрын
Yep, thats right, you are the best!
@Mafon2
@Mafon2 8 жыл бұрын
Great tutorial though I followed the instructions and still can't make the skeleton move.
@cyber_tech2872
@cyber_tech2872 6 жыл бұрын
that codes are compatible whit the game maker 8 ?
@askplays
@askplays 8 жыл бұрын
how do i do this with the built in physics engine?
@ProjectDT88
@ProjectDT88 6 жыл бұрын
How do you make gamemaker tell you if you are giving it an impossible path? Currently if you click where it can't reach, the enemy just gives up. I want the game to basically check to see if a path is possible before allowing it... how would I do that? Example: Tower Defense game. Enemy moves from point A to point B. You build a full wall between A and B and enemies just give up.... how do I prevent the game from allowing a perfect wall?
@helderperez1474
@helderperez1474 6 жыл бұрын
Check a path is possible from a point A to point B of your choice each time you build a wall block. If it is possible then allow placement otherwise prevent it being made.
@blah979
@blah979 7 жыл бұрын
Awesome tutorial. Worked first time with GM2.
@rellosorrell9265
@rellosorrell9265 9 жыл бұрын
How would this go along with the DS Grid we created in the Random Level generating? Edit: I now see that there are already a few posts asking about this, haha
@x7-a.i.208
@x7-a.i.208 3 жыл бұрын
Thats awesome! lot of thx !
@gekoghost806
@gekoghost806 8 жыл бұрын
how can add two instance collision for the grid??
@docnathan3959
@docnathan3959 8 жыл бұрын
I have an app called 001 Game Creator and the you do not need to code the enemy path finding as they can navigate in mazes without coding the AI
@Ivan-hi8vx
@Ivan-hi8vx 7 жыл бұрын
can you help me out with path find but for platform?
@jamesdrake8084
@jamesdrake8084 9 жыл бұрын
Hey Heartbeast, I'm currently making an isometric game (30 degree angles) and am in need of pathfinding. Is there a way to make the AI snap to the isometric grid and only use 4 way movement? I can't find anything on it anywhere and don't know where to begin. Thanks :)
@auraoctane9112
@auraoctane9112 8 жыл бұрын
+james drake I do not know what you mean 30 degree angle im not fond of isometric games but you could just try writing some if's on direction or hspeed n vspeed and set vertical movement on pathing to false so it move left right up and down and say if direction = 0 90 180 270 etc as many angles so if you decided to add diagnal movement and then do like image_index or sprite_index depending on how you send up you're images/animations
@muddykat-tech
@muddykat-tech 9 жыл бұрын
hi big fan love your work, i'm using your level gen system with tiles, ds grids ect. and i tried to overlay an mp_grid with objects in the same place as the wall to see if i can get the ai in this working in the random level gen slight problem it spawns right but as if its a mini map i guess you could say pretty much all of the instances are in the top left corner and seem to map out the same pattern that the level makes anyway i can fix this or is there a way to use the ordinal ds_grid for this without using objects this is what i used to make it happen in player create event var width = room_width div CELL_WIDTH; var height = room_height div CELL_HEIGHT; var cx = width div 2; var cy = height div 2; global.aigrid = mp_grid_create(cx,cy,width,height,CELL_WIDTH,CELL_HEIGHT); mp_grid_add_instances(global.aigrid,obj_ewall,false); in level create event this is in the for loop for creating the walls (btw) if (grid[# xx+1, yy] !=FLOOR) instance_create(grid[# xx+1,noone],grid[# noone,yy],obj_ewall); if (grid[# xx-1, yy] !=FLOOR) instance_create(grid[# xx-1,noone],grid[# noone,yy],obj_ewall); if (grid[# xx, yy-1] !=FLOOR) instance_create(grid[# xx,noone],grid[# noone,yy-1],obj_ewall); if (grid[# xx, yy+1] !=FLOOR) instance_create(grid[# xx,noone],grid[# noone,yy+1],obj_ewall;
@SnipingZero
@SnipingZero 9 жыл бұрын
I tried this and many other ways to set a path towards my obj_player for my enemies, but they simply won't move. what can I do?
@auraoctane9112
@auraoctane9112 8 жыл бұрын
+SnipingZero You must not have all your variables set right make sure you are calling the x and y from the right object if you are calling them at all
@SnipingZero
@SnipingZero 8 жыл бұрын
+Aura Octane nah i found then out that this method wasn't working due to physics enabled
@auraoctane9112
@auraoctane9112 8 жыл бұрын
Ahh ok. I was testing this A* algorithim and I would not know if you knew how to make zombies avoid eachother whilst they avoid walls wouldyou with only small amount of memory. I tryed adding and clearing cells as they walked but what happned was they detected there own cell of course and did not move like your's. without making a grid for every zombie I do not know how to add/fix this. :/
@xxcassweet322
@xxcassweet322 7 жыл бұрын
My game freezez when i add multiple enemies what do to?
@time.window
@time.window 10 ай бұрын
you're a genius
@TheLegoMasterMan100
@TheLegoMasterMan100 6 жыл бұрын
does anyone know how to add more than one type of object to the grid (buildings or others (say im doing something like starcraft)
@DaroGonzalez
@DaroGonzalez 3 жыл бұрын
I tried to use this on game maker studio 2 and get a massive loss of frames
@Krix08
@Krix08 8 жыл бұрын
for some reason i get a compile error two even (obj_grid in eventCreate action number 1 at line 5 assignment operator expected) second (obj_grid in eventCreate action number 1 at line 5 malformed assigned statement) WTH i replicated everthing you did but it doesnt work ;(
@pattyloca4773
@pattyloca4773 8 жыл бұрын
+Samanta Kristera The first compile error means you forgot an operator like "=" for example. the second one means you have a malformed statement, which seems to be a problem originating from the same source. Check the create event of obj_grid at line 5 for such an error and it should take you about 15 seconds to solve ! :)
@Krix08
@Krix08 8 жыл бұрын
ehhhhh i already have them ill show the code /// create the grid var cell_width = 32; var cell_height = 32; var hcells = room_width div cell width; var vcells = room_height div cell height; global.grid = mp_grid_create(0, 0, hcells, vcells, cell_width, cell_height); // Add The Walls mp_grid_add_instances(global.grid, Obj_wall, false); Hope you respond faster :) (cause i want it done faster)
@pattyloca4773
@pattyloca4773 8 жыл бұрын
I'm glad I could help, if you a have any other issues related to compile errors, here is the documentation related to them: docs.yoyogames.com/source/dadiospice/002_reference/debugging/compile%20errors.html
@pattyloca4773
@pattyloca4773 8 жыл бұрын
Does your code work now?
@Krix08
@Krix08 8 жыл бұрын
i dont really check my notification box that fast XD
@hydolsrodzas9328
@hydolsrodzas9328 9 жыл бұрын
Thanks, great tutorial!! Is it possible to make it works with physics?
@uheartbeast
@uheartbeast 9 жыл бұрын
Roi Díaz Souto That is a good question, you would probably have to do some sort of a work around. I"m not sure how paths work with the physics engine.
@upidesign896
@upidesign896 9 жыл бұрын
HeartBeast, How do you make the camera follow the screen and the sprites still be normal? I create a 1024x768 room, but then I dont know what should I put for the camera...
@FedeDrenge
@FedeDrenge 9 жыл бұрын
Check Shaun Spalding's video with camera views :) he shows everything
@auraoctane9112
@auraoctane9112 8 жыл бұрын
+UPI Design well if you are referring to this very example just set your view to the enemie obj... you would have to continously click to move from one side of the room to other but hey... theres others ways that are easy 2 like a invisible object that follows the camera that is controls by arrows or wasd
@auraoctane9112
@auraoctane9112 8 жыл бұрын
+Aura Octane Would not be very good for a profesional game as it would troubling to know where youre screen object is as when you hit edges of the room the screen stops as the objects continues
How I Learned to Create GAMES (No School Required)
9:47
Goodgis
Рет қаралды 577 М.
Smooth Path Planning Tutorial [Game Maker]
16:31
Cameron Penner
Рет қаралды 21 М.
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 8 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3 МЛН
GameMaker FREE RPG Crash Course: NPC, PATHFINDING, DIALOGUES
2:21:17
GameMakerStation - Matharoo
Рет қаралды 40 М.
How To Make Enemies Smarter: AI Weighted Decision-Making
11:37
Adding Your Suggestions to My Under Megabyte Sandbox Game
8:32
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,2 МЛН
Creating SMART enemies from scratch! | Devlog
5:40
Challacade
Рет қаралды 357 М.
5 Useful Scripts for GameMaker Studio 2 (and 1!)
9:34
Sara Spalding
Рет қаралды 100 М.
Secrets of Game Feel and Juice
5:19
Game Maker's Toolkit
Рет қаралды 1 МЛН
The 15 Commandments of Game Maker
16:32
PixelatedPope
Рет қаралды 125 М.
[GameMaker Tutorial] Stacking RPG Inventory
42:47
Heartbeast
Рет қаралды 42 М.
Devuélveme mi carrito 😭💔 #viralvideo
0:52
WADERLINFF
Рет қаралды 76 МЛН
Guli Mata ❤️🙏 #shorts #viralvideo #maa #trending #ytshorts #cutebaby
0:38
МЛАДШИЙ СЫН В СЕМЬЕ😂
0:22
Юный Повар
Рет қаралды 483 М.