🔴Game Maker Studio 2 | Advanced - Earthbound npc follow

Поділитися
Вставка
  • Опубліковано 17 жов 2024

КОМЕНТАРІ • 190

  • @ThomasFoolery
    @ThomasFoolery 4 роки тому +19

    I GOT IT TO WORK!!!!! My problem was I thought the first code in step was the same as create
    For instance
    Create was - i >= 0
    Step was - i > 0
    I ALSO added depth to the characters so they can walk behind eachother!!!
    THANKS SO MUCH!!! I thought I’d never solve it man...I guess taking a step back & or giving yourself a breather helps
    I’m extremely HAPPY!!! (This is a major part of my game btw😅)

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

      Glad you fixed it. Keep it up!

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

      Did you end up publishing your game anywhere (if it's done)?

  • @flowey7335
    @flowey7335 4 роки тому +12

    OMG that's exactly what I was looking for :D love u!!!

  • @username91011
    @username91011 3 роки тому +7

    Great tutorial. In case anyone else is having the same issue I was... my x and y were always reading as xprevious / yprevious. And thus[ if x != xprevious ] etc, wasn't working. This seems to me due to how I'd set up a lot of my player object handling... whatever.
    The solution seems to move the Update Recording code from the Step event to an End Step event. Simple. Hope that helps someone. Was banging my head on it for about an hour.

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

      Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

      There are no words to express how grateful I am to you, thank you very much! :,3

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

    This topic seems to cause a lot of issues for you guys, so I give the project free to use:
    www.patreon.com/posts/32829074

  • @netowgtz
    @netowgtz 3 роки тому +3

    "Earthbound Style"... just what I was looking for

  • @gamerboi_27
    @gamerboi_27 3 роки тому +2

    You sir are the greatest! The game dev gods shall bless you with massive fortune for your wondrous contributions.

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

      Thank you sir, may the other gods bless you also with fortune and fame.

  • @talentacquisition1746
    @talentacquisition1746 4 роки тому +5

    I love that you kept this specific and brief.

  • @itsybutsy
    @itsybutsy Рік тому +2

    Great tutorial, works fine.
    Two other things people might want:
    If your characters have separate idle and walking sprites, you can place this code in the follower object to fix that:
    if (x == xprevious && y == yprevious){
    if (sprite_index == sDW) sprite_index = sDI;
    if (sprite_index == sSW) sprite_index = sSI;
    if (sprite_index == sUW) sprite_index = sUI;
    }
    (Replace sDW with down walking sprite, sDI with down idle sprite, and so on);
    If you have separate running speeds and walking speeds for the sprites, you just need to do what you did for sprite index and image xscale.
    then, place this code in the follower object:
    image_speed = o_player.speedRecord[record];

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

      Thanks for adding this.

    • @kawanpld9969
      @kawanpld9969 7 місяців тому

      This worked for you? I made this mechanic but when my character run the follower teleport lol

    • @kawanpld9969
      @kawanpld9969 7 місяців тому

      Running i mean the character having two different speeds, walking and run

  • @tasharules
    @tasharules 7 місяців тому +1

    THANK YOU! I was trying to use move_towards_point and of course it didn't work the way I wanted but this worked way better.

    • @1upIndie
      @1upIndie  7 місяців тому +1

      Move towards point is very useful also, but it more for instant homing then following. Technically you could use it aswell there, but then you need to build your own workaround there also... Ah and thanks for being a long time sub, without you guys the channel would be dead already.

    • @tasharules
      @tasharules 7 місяців тому +1

      @@1upIndie I know what you mean by the work around LOL! in order to avoid the jittery issue I tried to come up with some work arounds but they didn't quite do what I wanted to do where as this tutorial was what I was envisioning.

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

      @@tasharules Nice, glad to hear I could help you out a bit. Keep it up!

  • @ThomasFoolery
    @ThomasFoolery 4 роки тому +2

    Thank YOU!!!! I haven’t tried it yet but I’ll tell u how it goes!

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

    HI THERE!! tutorial works wonders, however i still cant manage to make my follower stand behind the main player? it may be due to the fact that i’m working in a larger grid? but do you have any idea on how i can fix it? my characters keep overlapping:(

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

      Well, this video is kind of doing a recording of past positions where the follwers go after a delay. What you are looking for is rather a dynamic follower that is more like a drone or conga line (segemented). ua-cam.com/video/IWTXKwZj-Hg/v-deo.html or this ua-cam.com/video/ZWVqtA20Et0/v-deo.html
      Hope that helps!

  • @TheLegendarySandwich
    @TheLegendarySandwich 2 роки тому +2

    Hi 1up Indie! your video has been very helpful to me, so thank you! I have a problem... I have been following Shaun Spalding's tutorials too, and all of my characters walking directions animation are all in one sprite.... is there a way for the follower to change directions without depending on the players sprite? if you could help me i would be very happy so thanks again!

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

      Well, that is possible but then a totally different system, then they are more like drones following, which is another way how to solve such an issue. Something like what I do in this video but you give it different "distance" variables for each follower.
      ua-cam.com/video/IWTXKwZj-Hg/v-deo.html
      Was that what you were looking for?

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

      @@1upIndie ehm, I dunno. I kind of want the effect that he is on the ground, and not above you.... Is that something I can still achieve following this video?

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

      @@1upIndie I'm so sorry for bothering you....

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

      Since I still want it to change the direction it looks. It's basically a normal follower. Also my game is an Rpg so my character moves in 8 directions.

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

      I'm sorry I'm making so many comments😅 just having hard time explaining... Just all of my players animations are in one sprite, and the followers animations are in different sprites. (Basically followed your tutorial). I'm looking for what's in your video, I just want the follower to change his sprite on a way that's not based on the players sprite since they all are in the same sprite and I'm to far in to change it.

  • @jacksultubo4402
    @jacksultubo4402 Рік тому +2

    ii don't know why but when i put the code: image_speed = Ethan_obj.image_speed; , the follower keeps moving even if it stopped, if you know what i did wrong and tell me, i would be grateful

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

      I am not sure how to help you to be honest. They system is based on a delayed record systems, so followers cannot go where there is no record (they are not free agents so to say).

  • @ThomasFoolery
    @ThomasFoolery 4 роки тому +2

    2 questions! Is there a specific way I HAVE TO DO character movement for this to work!
    Question 2: if Not! Then why do I have this error!😅
    Fatal Error in
    Action number 1
    Of step event0
    For object obj_player:
    Push:: execution error - variable index [0,-1] out of range [1,94] - -1.pos_x(10035,-1)
    At gml_Object_obj_player_step_0 (line 13) - Pos_x[i-1];
    (I don’t expect you to know honestly...just wondering if I have to use a specific movement technique from another one of ur tutorials🤷‍♂️)

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

      1. There is no specific way how to do movement. What you simply do is update the x and y position of an instance to move it, that is it. How you achieve that is up to you. We tutorial guys give you solutions how to achieve that, but you can modify it to your own needs.
      2. Your error is saying: Your Pos_x is an array and your input (change to it) was with a number that you haven't defined in advance. Therefore it gives you an error.
      Hopefully you understand the difference between a variable (can change it to what you like all the time) and an array [ ] (is a fixed memory storage).

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

      1up Indie huh I just did what u did,don’t know why I got a different result😅
      4:54 idk why I’d get an error but you didn’t...
      I’ll try to figure it out,sorry if I’m bugging you😅

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

      @@ThomasFoolery No problem, this is part of the experience :D

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

    Your vids are the greatest! Thank you!

  • @iKiwed
    @iKiwed 4 роки тому +2

    Thank you for the video!

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

    I love the system, thank you very much for contributing it! :3

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

      Thanks a lot, hope you can put it to good use.

  • @Ericake
    @Ericake Рік тому +11

    This is obviously based on a code snippet I wrote in a reddit thread years ago. Same variable names and formatting and you also initialize the array backwards for no reason like I did haha. I'm a little annoyed you didn't credit me for the solution

    • @Ericake
      @Ericake Рік тому +5

      see here: r/gamemaker/comments/57oit2/earthbound_type_npc_follow/

    • @Sonikclaw2
      @Sonikclaw2 Рік тому +6

      Wow that's crazy, can't believe you're (not) famous now!

    • @tlk777
      @tlk777 Рік тому +5

      It does look similar....

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

      To be honest I am not even sure if the code is based by yours from Reddit, it does have some striking similarity (2 years ago, can't remember that for sure). I just look up use cases/solutions and try syphon them for the community and then mold it into a video.
      But it does seem to be very close to it, so credit should rightfully belong to you:
      www.reddit.com/r/gamemaker/comments/57oit2/earthbound_type_npc_follow/

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

      I think it would be only fair to add the crediting to your video description too, like you do for tiles and other assets

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

    Excellent tutorial. Thank you.

  • @R_Paranda
    @R_Paranda 10 місяців тому

    I keep getting the error of "PerformEvent recursion depth failure" within the var follow instance line of code. How do I fix that?

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

      Not sure how I can help you here. Maybe you are creating an infinite loop which breaks the game. You can try my discord help section, the offical Yoyo discord channel or post you code here (but from experience, not a lot of people will help you on youtube).

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

    I love your tutorials

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

    Sorry to bother you, but there is an error with the follower code, Whenever I run the game with the follower in the room, it just tells me that it cant find the player object, when it is in the room. any idea how to fix this?

    • @the3bros231
      @the3bros231 2 місяці тому

      Here's my code:
      x = oPlayer.pos_x[record];
      y = oPlayer.pos_y[record];
      image_speed = oPlayer.image_speed;

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

      I assume the player object is in the room also? Then your create order could be the issue (under layers (the instance layer) on the left side where you placed the player and the followers). The game loads/creates the followers first and they look for the player which hasn't been loaded/created yet. So, in this scenario change the "order" of the player before the followers. Hope that helps!

    • @the3bros231
      @the3bros231 2 місяці тому

      @@1upIndie Thanks, I will let you know how it goes!

    • @the3bros231
      @the3bros231 2 місяці тому

      @@1upIndie uhhh sorry for the dumb question, but...How exactly do you change the order? I tried moving the player object to the top instance layer and follower to the bottom, but that did not do anything...

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

      @@1upIndie Ok, I found a solution, but the follower stays on top of the player and the player disappears. And the follower just stays there.

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

    hello, thank you so much for this video and for the others, you are so much helpful, i want to ask one thing, if i want that the NPC follower behind the player make a triangle formation? How can i do this? Thank you for now

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

      Hm, if the followers are purely cosmetic, then you can pretty much ditch this complicated video and simply draw them in the players draw event but with different x,y positions.

    • @fierorecensione5828
      @fierorecensione5828 Рік тому

      @@1upIndie in truth i have a sort of system that allow to me to switch between 3 different characters, i want that when i switch the player that i'm using go on the top of this triangle formation

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

    how can i make it only work when something is true like
    if follow == true {
    code magically works and npc spawns and follows player
    }
    i don't really know how to completely change how the system works so there's no way for me to do that. ):

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

      Well, you can have a variable in "first" part of the conga line (the o_Player). So you have a variable that you toggle somewhere off/on (0,1) and call it follow.
      Create event o_Player:
      follow = true; // on on default
      Step event of all the npcs/obj_Follower:
      // here they follow if the variable is set to true, you encapsulate this condition
      if( o_Player.follow == true){
      x = o_player.pos_x[record];
      y = o_player.pos_x[record];
      }
      Hope that helps!

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

      @@1upIndie oh my God thank you 🙏🖤

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

      @@CaitlynWilson1413 Glad I could help out a fellow developer, keep it up!

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

    Is there a way to make the follower appear only if a certain variable is true? Like for example:
    if global.partyjoined = true {} and inside the curly brackets is the code to make them appear

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

      Yes, that depends how you structure your game/follower system. How you apply/redefine the system from the video is up to you.

  • @tutsie.r0ll
    @tutsie.r0ll 4 роки тому +1

    I got this working well for me but when my player dies while the npc is following it gives me this error:
    Push :: Execution Error - Variable Get 6.pos_x(100007, 6)
    at gml_Object_obj_npc_StepNormalEvent_3 (line 4) - x=obj_player.pos_x[6]
    can this be fixed? any advice is good.

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

      1. If you are using gms 1, then as far as I know you don't have instance_create_layer/instance_create_depth. You only have instance_create.
      2. There seems to an issue with the index of your array -> pos[ index ]. The follwer tries to get info from an instance which is not there any more. That cannot work.
      To fix this issue, you need to destroy your followers aswell or disable that portion of code where they read that array from the player. " if (instance_exists ( obj_player ) ) { .... }"

    • @tutsie.r0ll
      @tutsie.r0ll 4 роки тому

      @@1upIndie in my game I have npcs that follow you once you talk to them. I have a variable set so that this happens. When the player collides with an enemy they turn into a different object which is their death animation, which I have set to a separate object.
      here is the code in my npc step event:
      if following = true
      {
      x=obj_player.pos_x[6]
      y=obj_player.pos_y[6]
      }
      if following = false && (place_meeting(x, y, obj_player)) && keyboard_check(ord('Z'))
      {
      following = true
      }
      if following = true && !object_exists(obj_player)
      {
      following = false
      }
      ive also tried creating another object that the npc turns into so that it has a similar death animation as the player if the player dies, and it still gave me the error. I cant see what is going wrong?

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

      @@tutsie.r0ll Hey Randa, I am here not sure how to help you. My job is to give you guides, ideas etc. or basically quick fixes to problems. If you got some small issues, I can look over your code. but please don't abuse this. There is a yoyo forum for that or go into my discord where the other guys might help you out.
      Direct help from me is reserved for collegues or patreons.

    • @tutsie.r0ll
      @tutsie.r0ll 4 роки тому

      okay, thank you for the help

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

    I love this channel! Will you make a platformer level generator tutorial?

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

      Yes, that is in the works, but will take some time. This is hardcore stuff.

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

      @@1upIndie True.I am a big fan of your chanel mate.Your tutorials are marvelous!

  • @sumbudi2734
    @sumbudi2734 3 роки тому

    what exactly do I have to consider if I want to program a room transition with the following object? best wishes and merry christmas :)

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

      hm, basically use the first one as a template and every time you transition you respawn everything fresh. Or you can flag/set the start object and the followers as persistent, so they will be take into every new level/room.

  • @AugustoCésarDegasperydaGamaCab

    if you're doing like me that makes your character sprite go back to 0 when you stop and what to do the same to your followers just add this to the step event of your follower:
    if obj_player.image_index == 0{
    image_index = 0;
    }
    it's not glitch since all of the movements are simonized (mean that if your sprite goes back to 0 WHILE walking your followers will be also be 0)

    • @unknowngamer8736
      @unknowngamer8736 3 місяці тому

      no didn't work my npc character is still walking on air.

  • @joezuru3753
    @joezuru3753 4 роки тому +2

    what if I want the character to dynamically return to a previous state, like an iddle everytime the player stops walking?

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

      Make an additional if statement where you have have a mini timer set. So after no movement is there for lets say 2 seconds, go into the idle sprite.
      Something like that -> if (pos_x[0] == pos_x[15] and pos_y[0] == pos_y[15] ) {
      miniTimer--;
      if (miniTimer < = 0) { sprite_index = spr_IdlespriteSomething; }
      }

  • @squidxl90
    @squidxl90 9 місяців тому +1

    I did the tutorial and just the animations don't work, the follower animation just goes up and it doesn't change, and i have no idea how to fix that

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

      I don't know how to help you to be honest. You can download the sample project for free (first comment) or ask in my "help" section of my discord.

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

    great tutorial, it looks exactly like earthbound! how would you get it to be like mother 3's follow system with a run, though? When adding a run the characters seem to separate due to the change in speed. i'm guessing you have to make a set maximum distance the followers can be from the player... but I don't know how to do that lol

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

      Yeah, a lot of people have issues with that video + project, that's why I made it public to everyone to download. www.patreon.com/posts/32829074

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

    Thank you so much for this tutorial! But I have a quick question that I hope you can answer.
    I am using this follower mechanic in combination with jumping mechanics.
    When my player jumps over an object, but my follower does not, the follower just teleports right through it to record the player.
    I have collisions set for every object, but obviously the record mechanics overrule the collision.
    Is there anything I can do so my follower still records position movements but is affected by collision?

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

      Well, the followers are basically ghosts that mimic the movement of the player with a delay. Here you need to define how "independend" these ghost are. So I am not sure why you want collisions to take place for them, because the player already handles collisions and the ghosts simply follow. This system is therefore quite static. You would need to make make an ai the corrects the movement.
      Maybe what you are looking for is not a ghost/follower but a drone of a sort -> ua-cam.com/video/IWTXKwZj-Hg/v-deo.html

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

      @@1upIndie Yeah I know that this is an odd concept to bring up. The reason why I want collisions for followers is to mimic the mechanics of the game Mario and Luigi Superstar Saga. This tutorial almost seems exactly what that game uses. When Mario jumps up on a platform you need to jump with Luigi too, otherwise they will both get stuck. I have been looking at footage of that game and it seems that maybe it just creates an invisible wall in front of Mario until Luigi jumps on the platform too. The drone could also be a possibility though.

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

      @@TheDiceShak3r I just checked out the moving mechanics of "Mario and Luigi Superstar Saga". They use a similar system like mine but have also auto correction in play. So movement is similar but when jumping ( it is a state) locks the second "ghost" player, see it like an auto complete system that takes away the controls from the player and does a predefined moveset for both. And that you need to make by yourself.

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

    Great tutorial.

  • @HeartMoonlit
    @HeartMoonlit 11 місяців тому +1

    I tried to do it for a platform game and it works only that the npc stays floating in the air until the player keeps moving 🤔

    • @1upIndie
      @1upIndie  11 місяців тому +1

      Yeah, the system is made for top down game, so sidescroller got this :D. Maybe do a hybrid (when not moving that the follower be in a state to get to close the player if he is on the ground and a timer runds down to make a failsave) or tread the followers like drones.
      ua-cam.com/video/IWTXKwZj-Hg/v-deo.html
      Hope that helps.

    • @HeartMoonlit
      @HeartMoonlit 11 місяців тому

      Oh thank you very much I'll try it :)

  • @Helpy-ge6uf
    @Helpy-ge6uf 3 роки тому +1

    ok now I know how to ask. I want the follower goes with player in the same room when to teleport, I tried to destroy the object and create them to the same player's position that even works, but the follower return to the record position, there is a way to follower warp with player to another room? sorry to ask it, it's because I'm really really noob in gamemaker.

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

      Well in that case, reset the recorded positions. This shouldn't happen though if you by swapping room destroy the player+followers and then create them again in the new room.

    • @Helpy-ge6uf
      @Helpy-ge6uf 3 роки тому

      @@1upIndie I already try destroy them, so It's better for me reset them
      edit: I forget to turn off the persistent on player so It's very good for me

  • @kiwipie9415
    @kiwipie9415 3 роки тому +2

    Love you for this video, works perfect! Im making an RPG with an worm-like enemy. The worm hides in holes and reach out for the player when he steps too close to the it. I wanna have a head who does everything and a seperate object which will be the body who follows the head. when the enemy has striked the player it retracts to its hole and destroys. How do i make an object go backwards with your technique? IE, instead of keep following the head, it goes bavkwards to the previous x and y?

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

      What you can try is this: ua-cam.com/video/bzVdLZsmwdQ/v-deo.html
      The follower mechanic is more for a npc follower. You could remake it for your purpose, but the video linked here will suit you better and is easier to implement.

    • @kiwipie9415
      @kiwipie9415 3 роки тому

      @@1upIndie this setup workes better for the enemy im creting. I should have been clearer, im trying to make it so the tail of the enemy stays in the hole, drawing a line of orbs from the hole to the head. When it retracts the body parts follow where the head were and leaves the hole. Is there any way for the orbs to move backwars to the previus y and x target? So it looks like its going back in the hole orb for orb.

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

      @@kiwipie9415 It depends how your enemy looks like. Let's say 4 body parts in one line, then I would go for one object that draw those parts in that line relativly. So image a line between a startpoint (x,y) and an position where the last part (x,y) is (draw one part at the start and one at the end). Then get the distance between startpoint and endpoint and end place (with help of lengthdir_x, lengthdir_y) and draw 2/4 and 3/4 in. Kind of difficult to discuss this here without picture. I am now online in my discord, so maybe I can help you quickly there.

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

    Does the followers bug for anyone else when you try to change rooms? For me, when I use this code and try going to another room, the follower kinda "delays", not spawning the same position as the main character, until I take some steps.

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

      You have "other" event, called room start, where you can remedy this (instantly teleport them to the players or where every you want them to be/override their array x,y positions). I assume your player character and the followers are toggled as persistent?

    • @Jesse_Lacerda
      @Jesse_Lacerda Рік тому

      @@1upIndie yeah, thank you, gonna try that out.

    • @Jesse_Lacerda
      @Jesse_Lacerda Рік тому

      @@1upIndie Oh, it didn't work. The main problem is, when the room starts, the follower appears far away, but when I move, she comes to the right position, so the problem is either in the record, or the warping controller.

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

      @@1upIndie Nvm, I managed to fix this using the array reset upon changing rooms you mentioned in another comment, thank you very much for the help and tutorials!

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

      @@Jesse_Lacerda Glad you could fix it, keep it up!

  • @BlackMantisRed
    @BlackMantisRed 5 місяців тому +1

    This code can be improved using
    PosX = array_create(lengthofArray, x);
    PosY = array_create(lengthofArray, y); to create the variables
    and using this function in the update function
    array_copy(PosX, 1, PosX, 0, lengthofArray-1);
    array_copy(PosY, 1, PosY, 0, lengthofArray-1);
    With this no for loops are required

    • @_hamhead_
      @_hamhead_ 3 місяці тому

      where would this go?

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

    Making a game that would take place either on a large scale distance wise or with light slowed down, so distance and time determine what the player sees- everything is delayed depending on how far away it is. I've been having trouble figuring out how to do it but it seems this is the most important part of how to do it. Just gotta modify the code a bit to take into account distance in order to determine where the 'follower' is displayed while the leader is hidden, farther away = bigger delay. This is a weird project, I don't really have a goal- I'm just playing with the idea and hoping that something fun comes out the other end- I am optimistic though!

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

      Hm, not sure what you are trying to do, but give it a try. Great games come from experimentation/accidents/bug is now a feature things.

    • @Chaos_God_of_Fate
      @Chaos_God_of_Fate Рік тому

      @@1upIndie The idea is something like: when you see a Star that's say, 100 light Years away, you see that Star as it was 100 Years ago- it may have moved or even exploded since then but we won't see it until the light gets here. Call Earth the Player character and call the far away Star the Enemy AI- the farther away an object is, the farther back in time you see, while the Star may be somewhere else now- the closer it is, the less delay in where you see the Star's 'ghost'. It's very hard to explain this idea to anyone, even in real life people don't get it when I try to explain- it's one of those things that will make sense when I get it working. So far I've modified your example into what I'm looking for and it's almost working exactly how I want, just got to tinker a bit to get it to behave just right! Then the real fun begins- experimenting with the concept to see what might be fun to do with it.

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

      @@Chaos_God_of_Fate Interesting, so you are basically overlapping different times in one room and showing the ghostly remains of the things. Wonder how that looks like with hundreds of "to show" things clustering. In any case, cool concept, keep it up.

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

      @@1upIndie Just got it working how I want. It's really interesting seeing it in action. Now to see how many I can have on the screen at once- they're all recording x/y/rotation while measuring distance to the player every frame so I doubt I can have tons of stuff moving. Anyway, thanks for making the tutorial :D

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

      @@Chaos_God_of_Fate You are more then welcome mate!

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

    It doesn't work for me , it just spawns and the sit where it was created
    create
    array_size = 94;
    for(var i = array_size-1; i >= 0; i--){
    pos_x[i] = x;
    pos_y[i] = y;
    }
    var follower_1 = instance_create_layer(x,y, "Instances", bod);
    follower_1.record = 10;
    speed =1;
    step
    if (x != xprevious or y != yprevious){
    for(var i = array_size-1; i > 0; i--){
    pos_x[i] = pos_x[i-1];
    pos_y[i] = pos_y[i-1];
    }
    pos_x[0] = x;
    pos_y[0] = y;
    }

    • @the3bros231
      @the3bros231 2 місяці тому

      Did you ever fix this?

  • @_hamhead_
    @_hamhead_ 3 місяці тому +1

    when i add image_speed = o_player.image_speed the follower still doesnt stop animating

    • @_hamhead_
      @_hamhead_ 3 місяці тому +1

      also i didnt realized you replyed to the last comment (that i deleted cuz the bug was a typo and i fixed it and i was embarrassed) good god man

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

      Glad to hear you could fix your issue, keep it up man!

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

    Hey, Can you make this tutorial for Game maker 1.4?

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

      The code is very universal, so 95% wiorks also in Gm 1.4. There will be no tutorials from my side on Gm 1.4 because that engine is old, not supported any more and you cannot buy/get it legit. It makes no sense for me to do tutorials for this dinosaur.

    • @rikbiel
      @rikbiel Рік тому

      @@1upIndie But what would I have to exclude or add to make it work in GM 1.4?

  • @fotty1
    @fotty1 3 роки тому

    cant get mine to work :( whenever I testrun the game the character stays in place and is frozen, then it crashes. any idea on how to fix this? I'm kind of a beginner and don't know much. I've checked over and cant find any mistakes

    • @fotty1
      @fotty1 3 роки тому

      there's also a small duplicate of the player aswell????

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

      Please don't send crash reports on this youtube channel. I have a discord where people actually help each other for such things plus the project is free to download.

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

    I tried this method, and I had many errors and fixed them, but the movements are very stif for some reason..

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

      Hm, it is a choppy "retro" system. If you want to smoothen it, do more records per seconds or (advanced) do a lerp function to even smoothen then walking for the followers more.

    • @WolfieMoonDev
      @WolfieMoonDev Рік тому

      @@1upIndie well I just mean it just is very stiff and is directly on the right side of the player no matter what direction I go

  • @Helpy-ge6uf
    @Helpy-ge6uf 3 роки тому

    how can I warp the npc toguether with player and stay of the same position of him, It's because I have been trying a lot and nothing works as I want.

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

      In that case you don't need to have nps, you simply draw each one of them over in one draw event of the player.

  • @kingparat1258
    @kingparat1258 3 роки тому +2

    Truly legendary tutorial! Have subscribed :) Would you know of a way to make the followers move to their correct positions upon changing to a different room?
    Currently for me when the room switches (e.g. player enters doorway) the followers end up away from the user as the user moves to new coordinates in a different sized room. They then return to their correct positions when the user moves (as new positions are recorded by the user for them to go to).
    If you knew of a way to somehow reset the recording of positions upon changing rooms that would be excellent!

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

      Well, what I would do it simply spawn the followers each time in the new room after the player has changed his position(so you have to destroy them when you swap a room). You can use xprevious and x/yprevious and y, and well compare those.
      So you could have a counter variable, that goes up (counter++; ) and you spawn one follower after let's say 20 counter and then 40 another etc.
      Alternative:
      A lazy way would be to reset the array(s) and set all the followers x,y value instanlty on the same spot as the player.

    • @kingparat1258
      @kingparat1258 3 роки тому

      @@1upIndie thanks heaps for getting back to me I really appreciate it :)
      the lazy way sounds perfect to me (I'm a bit of a noob haha), would there be a 'best' way to reset the array? Got the followers to move to the x and y value of the player but I must confess I'm stumped trying to reset the array
      EDIT: I found a way to reset the array that works using a room_change variable (flicks on and off as fade transitions through rooms) by re-arranging your code, if you see any issues with this method feel free to let me know:
      if room_change=true{
      for(var i = array_size-1; i > 0; i--){
      pos_x[i]=x;
      pos_y[i]=y;
      }
      pos_x[0]=x;
      pos_y[0]=y;
      }
      else
      if (x != xprevious or y != yprevious){
      for(var i = array_size-1; i > 0; i--){
      pos_x[i]=pos_x[i-1];
      pos_y[i]=pos_y[i-1];
      }
      pos_x[0]=x;
      pos_y[0]=y;
      }

    • @StompaJay
      @StompaJay 3 роки тому

      @@kingparat1258 You two are kings, o was having this trouble and i couldnt find a way to resolve the issue, thanks!!

    • @kingparat1258
      @kingparat1258 3 роки тому

      @@StompaJay No problem happy to help!

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

      @@kingparat1258 what is the room_change variable set too?

  • @tutsie.r0ll
    @tutsie.r0ll 4 роки тому +1

    can this be done in gamemaker studio 1?

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

    Hi, this is a pretty epic tutorial but there's a problem. It just doesn't work. When ever I go and test the game, it just has my player move but the follower just stay in one position.
    I'm not sure if I'm just being dumb at this moment or if my code is wrong (which i checked and it's exactly like yours) but it just doesn't work. So I don't know what's happening.

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

      I cannot look inside your code. I assume there are 2 reasons why the follower is not following the player. 1. You didn't set in the x,y coordinates of the follower to the updated position in the step event: x = o_Player.pos_x[record]; y = o_Player.pos_y[record];. Or (2) you are not updating the "new" recored positions in the array of the player: pos_x[ ], pos_y[ ] and therefore the follower is not getting new values so it can update and move correctly.
      Hope that helps.

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

      @@1upIndie Oh, i found out what it was, i was using all the code for making the movement and the position traking in the same step event, i fixed it by puting the movement in a begin step event.

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

      and thank you for trying to help me, already you helped me and many more with this video

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

      @@spiritlamp6324 Sweet, glad to hear that!

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

    So I followed this *finally* and I’ve ran into a bug because the way I made my player, Unlike ur character when standing, instead of pausing the animation...I have my character have a completely separate sprite for Idle!
    My problem is that my Follower won’t *for some reason* Play the idle animation when they stop walking, instead they loop their run animation until I change directions. I tried adding more code like
    “Case Sprite_PlayerRightIdle; sprite_index = sprite_rightidle; break;”
    But for some reason it seems like it does nothing🤷‍♂️

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

      I don’t expect to get an a proper answer/solution, it most likely will come down to me messing around for a few weeks and miraculously fix it😂👌

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

      @@ThomasFoolery Well, maybe give the followers some extra code. For example they could check if their x is the same as the previous x (same with y, previous_y)
      Code:
      if (x == xprevious and y == yprevious) {
      sprite_index = spr_Idle;
      } else { sprite_index = spr_Walk; }
      So here swap their sprites depending if they are moving or not.

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

    It's amazing, but if the scroll is hspeed = 2 (for example) and o_Player.hspeed = o_Scroll.hspeed ????

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

      What=?

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

      ​@@1upIndie I try to explain myself better.
      If you record the x,y player positions in a static view this works, but when there is an automatic scroll the x,y recorded coordinates have not moved with the scroll. Therefore, the positions recorded when there is a automatic scroll are no longer the same and each follower will be left behind each other.
      If the player moves automatically (to remain in the view) horizontally at the speed of the horizontal movement of the view or scroll, the x,y positions should be recalculated according to that speed.
      You speak Spanish, right?

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

      @@khromemusic Not really, I use the power if google translate. Not sure what you mean, I tested this with zooming out and in, and it still was the same. You record old x,y positions of the player, which don't really change even if you change your camera zoom. Are you refering to a scrolling (of your view) and the positions are off?

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

      @@1upIndie Yep, I mean that if the player does not move the scroll, that is, if the view does not follow the player object but rather a scroll object that moves at a certain speed, to keep the player on the screen, its speed must be the same as that of the scroll object that the view follows. Therefore, when recording player positions and it is moving automatically accompanying the view (or the scroll object that follows the view), the saved positions will have to be added the pixels that it has traveled automatically because of going to it Scroll object speed so as not to fall behind if you don't move.

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

      In your tutorial, the view follows the player. Create o_Scroll with vspeed = 1 and change the view for following the o_Scroll. Add vspeed = o_Scroll.vspeed in create event of the player. Try NPC now.

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

    My game keeps crashing whenever I move, I'm able to move for a frame then the entire game freezes.

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

      Nevermind, got it working now, thank you for the tutorial!

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

      Good to hear. Keep it up!

  • @goken-san9224
    @goken-san9224 4 роки тому

    I am getting this error called "instance_create_layer :: specified layer "Instances" does not exist". I made sure everything is right but still got this error

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

      This error is telling you that your "Instances" layer doesn't exist. This is the default one that is being created in the default room or when you create a new room. Did you rename or delete it? You can find it on the left side in (room editor).

    • @goken-san9224
      @goken-san9224 4 роки тому

      @@1upIndie Fixed that part already. Right now, I am stuck on the part when NPC doesn't face left when the player faces left, and after assigning animation sprites, the NPC doesn't move. Another part I am stuck at is changing the NPC's position when following the player.
      P.S.: I am doing a 2d side scrolling game

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

      @@goken-san9224 Okay, not sure how I can help you here. If you got something to show (your game), drop me a comment or link and if its good enough, I can make short video about it.

  • @rinkun6689
    @rinkun6689 3 роки тому

    Could you do a earthbound rpg system sometime? ;; like you have no idea how amazing that be, I’d pay to see that course c:

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

      I could offer that as a course on Udemy. But that will take some time, need to finish other stuff. But I will ask in the community tab in the future, if you guys actually want anther Udemy advanced course.

    • @rinkun6689
      @rinkun6689 3 роки тому

      @@1upIndie oh that be great! And Im sure some would feel the same c: thank u so much for responding too

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

    Good job.
    BTW: f8 to resize the text in code editor

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

      Neat, that will help me in future videos. Thanks mate!

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

    First , love your work

  • @kayto4489
    @kayto4489 3 роки тому

    how do i switch the follower in game?

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

      The followers are simply dummy instances that have no other function than to follow. To "switch" them you simply change their spirte/image you wish to have.

  • @greenglubs
    @greenglubs 5 місяців тому +2

    (SOLVED!!!) i had an issue with the follower not appearing in the next room, but i solved that by putting this in my player's room start event:
    for (var i = array_size; i >= 0; i--;)
    {
    pos_x[i] = x;
    pos_y[i] = y;
    }
    it works fine, but my follower appears above the player when in the other room they were under. how do i get them back under?
    edit: i fixed it! if anyone else is having this problem, just put this in the room start event:
    instance_destroy(oFollower);
    for (var i = array_size; i >= 0; i--;)
    {
    pos_x[i] = x;
    pos_y[i] = y;
    }
    var follower = instance_create_layer(x, y, "Instances", oFollower);
    follower.record = 10;

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

      Glad you could fix it!