Hello all! There is a bug in our animation system: the last frame is playing incorrectly. I've made a new video addressing this, so make sure you watch it to update your code. It's a very quick and easy fix: ruclips.net/video/hxKlOlQ7Mdc/видео.html
Thanks so much for the support, everyone! I can't help but be a little nervous every time I post a video, but it's so reassuring to read such lovely comments. I forgot to mention that I've set up a twitter: twitter.com/FCosmonaut. From now on, I'll be posting links there to new videos as soon as they are uploaded.
Cheers! I won't stop anytime soon. Although I have to say, there's tonnes of wonderful creators out there for GM2 :). If you're hungry for more content, or just some fellow devs to chat/showcase what you're working on/get help, I'd highly encourage you check out the GameMaker Discord. Here is an invite link (via reddit) if you're interested: www.reddit.com/r/gamemaker/wiki/discord The more the merrier! :)
The discord is really helpful and has (mods?) as well as other members that help you problem solve in real time issues that you might be having with your code.
it's absolutely INSANE to me that this series doesn't have more views!!! this is hands-down the BEST gamemaker studio tutorial i've found so far, even better than paid ones I've seen, and it's FREE!!! you explain everything so clearly, and you not only show us how to do stuff, but also WHY, which is hugely beneficial. you don't just show us how to build *your* game, but how the different tools work so we can build our own games without just copying someone else's. i'm super super super grateful for this series, it's such a lifesaver, especially given how frustrating it can be trying to delve into video game creation without a background in code. imagine me sending you a bouquet with a thank-you note attached.
Just want to let everyone know, but you can click and drag the pngs into the Sprite groups, and GMS will automatically create the sprites. This works with multiple pngs selected. In addition, you can click and drag whole folders in, and GMS will generate sprites and groups (based on the folder hierarchy within the dragged folder) automatically!
I just discovered your channel, and after watching s few minutes of your teaching style, I insta-subbed. Excellent work explaining thee whys and hows of your elegant programming style. Having worked with LPC on my own, this method saves so much work over turning the sprite sheets into strips. With a small team, automating with code is almost always a better solution than manual labor. On that note GMS 1.x and 2 have a labor saving way of importing lots of sheets or strips at once: 1) Create all the group folders and sub-folders in the sprite tree. 2) Name the sprite sheet and strip files what you want them to be called. (for instance "spr_BaseManDark.png" and "spr_DoorOpen_strip5.png") 3) Just drag and drop them from the file explorer onto the GMS group folder you want them in, and GMS will automagically make the sprite resourse with the file name. Additionally, if its an animation strip and you named the file ending in "_stripX" where X is the number of frames in the file, GMS will automagically break it into that amount of sub-images.
Just wanted to say, this is one of the very rare tutorials I've watched all the way through, instead of just scanning for the information I needed. I really like your tutorial style and appreciate the work you put into these.
They should be giving you buckets of cash for this. They should have this on the front age of their website. I've no doubt you've convinced countless beginners to fork out the cash for the creator version with this video. You've definitely convinced me. You have a talent for teaching, and I appreciate you sharing it with us so much.
This series is AMAZING!! Total package, everything a beginner could want, 10/10! Thank you so much for taking the time to share this series. I absolutely appreciate it.
I don"t need such a beautiful sprite drawing system for my game, but damn, I love how you make your tutorials so much! After Space rocks I passed by other tutorials, but I missed your style of teaching things so much. Thank you! I wish you all the best with all my heart! Don't stop teaching.
Very insightful! Thank you for a great tutorial. I really like how you're not trying to cram it all into a shallow 4-minute video but instead devote the time necessary it takes to explain your setup in depth.
I can't believe I have found this tutorial series before, this is exactly the stuff I need for my game and I haven't found anyone else doing this the way I wanted. Thanks so much!
Perfect timing on this series as I just got GMS2 a few weeks ago and intended to make this style game once I learn the language and get a firm grasp of the program. You, heartbeast, and a few others have made the learning process much easier.
I’m absolutely floored by the quality of these tutorials. They feel so natural and unscripted but move at a great pace with no awkward downtime. It really helps beginners to see and hear the thought process behind working through these solutions. Truly a great teacher!
This tutorial series is amazing and you're amazing, thank you! This is exactly the type of tutorial I've been looking for. I've been slowly teaching myself GM in my free time and guides like your's are a HUGE help. You're awesome
I found that trying to implement your own set(s) of movement after finishing the tutorial was really helpful for solidifying my understanding of the system she set up, and would recommend trying to implement the "death" animation (y_frame = 20) by pressing space bar or something similiar. It also really brings home how powerful / flexible this system is granted you set your sprites up in the appropriate format.
This is a really great series, I don't know how you have so few subscribers. Your videos are honestly the most helpful coding tutorials I've ever seen, all of the other ones I've found just dumb a bunch of code on you without really telling you what it's meant to do.
Very well made! This is the way it should be done and this is the first video I've seen that I think does it the animation and drawing of sprites effectively! I've recently been building an extension or engine that reads sprite information from a file and draws the sprites in the proper places based on a file in a very similar manor (similar to spine but with multiple directions and easier to change attributes / params for the accessory types). Great Job!
Man this is awesome. It's so easy to go through what you are doing. It's all currently working with GMS2 as of Jan 2 2021. I have a game up and it feels good to see this coming through. Thanks for explaining the concepts and what not. It's helping me understand GML.
Thank you so much for having so many uploads about GMS2. I have literally watched everything HeartBeast has to offer, and its wonderful to get different perspective too! He taught me in a certain way and I am getting a repetition from you using different words. Really helps me to memorize a lot. Thank you so much!
wicked! How long have you been coding for? Do you do it professionally? Im a 3d environment artist professionally but would love to make my own games in my spare time. Coding is just such a huge mountain to climb!
Hehe no, not professionally! Basically I've dipped my toes in coding waters at a few points over my life (for school, data analysis, and then as a hobby), but I probably only *properly* started coding about a year ago. And I can say from my small amount of experience that although it may seem daunting at first, you can learn a lot fast, and I have to say GameMaker is ideal for this. And programming is SUCH satisfying work. So if you're keen and starting out, I can recommend: consume a LOT of tutorials, become best friends with the documentation (middle click on a function every time you learn a new one/forget what something does), make mistakes, and solve lots and lots of errors. Programming is tonnes of fun :)
I added in all the assets for the player character and it made the collision stop working and then now i have the yellow box leaving a trail everywhere, great videos! maybe im not the best at following
Thank you so much for these videos! I have been wanting to make a game for a while but had trouble getting my head around the programming. But, you are making it seem possible!
wow that was a beautiful drawing system. After some months looking into game dev I just realized I'm still just a beginner which is good because the solutions for the problems I'm facing can be done beautifully, like here. Thanks for the videos. Subscribed! ps: as mentioned by your community you have a rly good teaching method :)
Cheers for this.! Again, Brilliant tutorial! .. You were talking about making your spritesheets smaller at the end, GMS makes its own spritesheets at compile time of the only sprites you use .. So GMS essentially makes them smaller for you anyway ...
I'm not sure I understand -- I meant if you're using a large spritesheet in the way we are, but don't end up using everything on it, we might as well get rid of those sections. GMS would be grabbing the whole sprite sheet, wouldn't it? Or did you mean the "space" between the frames? (And thank you!)
Cheers! Yeah -- GameMaker has a great, intuitive "one sprite at a time" system, but due to the sprite constraints in the trial version, and just that it's fun to try something new, I thought I'd showcase another way of doing things. Glad you enjoyed it!
I always come by to drop a like when I see your videos are up. Not using them right now, but I will take a look at them in the future. Loved your depth tutorial and will def check out your text box tutorial. The only suggestion I have is to add a subtext or episode number to your thumbnails, to better distinguish between them. Otherwise, I like how the thumbnails look for this Farming RPG series. Keep up the good work!
Thanks a lot :)! I liked your suggestion and have updated the thumbnails; it's nice and easy to do, and makes it easier to distinguish them visually. So thank you!
If i found this helpfull ? I start to the real 0 skill in coding and programing and your video are really usefull, i start to understand the logic and avoid basic mistake.
Eeee!!! Thank you so much for this video. I've been stewing on an Animal Crossing style game for a while now but never really understood how it should be set up... This video has been so helpful!
Man I wish I found this video last year, I spent months upon months importing all the different sprite sheets from the LPC collection, I only managed to get around 300+ sprite sheets done, but I decided to change the colour of the sprites (Where possible) in game maker to be able to minimize the amount of importing I was doing.
30:13 FriendlyCosmonaut I followed everything you did but with the outline; it's like a vertical box that increases and decreases in size (vertically) based on movement of the sprite. Moving left makes the mask go above the character and moving right makes it go below. I honestly have no clue what I missed or anything because I followed you to the T. Thanks!
If you're still having problems with this could you reply with the snipit of your code thats causing you problems, i've been going through the series just recently and maybe could lend a hand.
Is there a reason to use sprite_get_xoffset() function instead of sprite_xoffset variable? I thought that sprite_xoffset would be more appropriate since it already takes into account the x_scale property.
Heres a tip for anyone who doesn't understand what the code does. For each frame write down what each variable is equal to. Do the math on paper. For example, to better understand this video i wrote down what frame_x would equal after adding anim_spd/60 to it. This helped me to better understand the logic behind the animation speed. (More specifically, the floor(frame_x)*frame_size bit)
I rewatched the bit where you added the floor function, and you perfectly describe what's happening. I must've lost focus the first time i watched it. Still, I stand by my advice. And thanks for the tips you gave me yesterday. I plan on being persistent and using every resource available - as well as partaking in the Game Jams. Thanks for the work that you do!
Thank you for the lovely tutorial! I'm trying to make a retro rpg with grid based movement (with animation going on while moving), I'm struggling on figuring out what to change to make that possible with this code. Any advice would be greatly appreciated!
So I build my own character customizer. I utilized the logic you showed but now I have an invisible moving sprite :( both independently work but I can’t seem to get it to work for both at the same time
I know I'm late, but my character won't animate at all? It will keep a still frame. Im at 18:30. I copied what you did but to no avail. help? (edit): I got the animations working, but of them makes my character invisible?
I had this same problem. Most likely x_frame is getting too large like what happened with me and so there is no sprite and the character becomes invisible. Think of x_frame as a panel or page number rather than the x coordinate of where you want it. So x_frame should never be greater than 9 in this sprite sheet, 1 would be the second sprite, 2 the third etc.
Thank you so much for these videos! I am having an issue with the animation of my sprite. The animation plays fine but something is off and a line appears to move through the sprite at the last frame. Something seems offset but i cant find where it happens.
So, I'm trying to add in my own sprite sheet using the same concept- 64x64 boxes, but my sprite sheet is smaller (so the walking anims aren't halfway down the sheet, they're at the top). But, changing the numbers (the 8 through 11 to show where it's getting the sprite from), but doing so makes the sprite, say, walk up but facing to the left. I can't quite figure out how to fix it. I can usually get one or two going the right way. Edit: I figured it out, sorry. I didn't realize the first row doesn't get counted (if you mentioned, I didn't notice, again, sorry!) But shifting everything down out of that first row fixed my problem right up.
Delayed comment, and I realise you found a fix for yourself, but, remember that in programming a lot of the time 0 is the first value, not 1. So that might be why you found it doesn't read the "first row". 😀
Great video! Tons of important information and presented very clearly. Do the multiple draw_sprite_part calls per character hurt the performance? I'm think especially when played on less powerful phones. Thanks so much for your hard work on these tuts!
hi i have a problem i wrote the code same your code and used the same code and same png when i use this code (else x_frame = 0;) the charecter stop animated to right and left but keep moving to right and left seems it like drage it
So... my collision box seems to be anchored in one place, and grows and shrinks as my character moves around. Can't seem to find the problem - any ideas? (I'll keep looking though)
So I'm actually having an issue with the draw_sprite_part function following your tutorial. I'm a little bit further than this point, but when I start the game, none of the character sprites are drawn until they move. Can anyone help me figure out what my issue might be? I can send the code too if that would help.
You've probably solved this by now but just adding a comment in case it helps someone. I was having the same issue halfway through the video, and eventually I was able to solve the problem myself, so then I went back to the video - very proud of myself - only to discover that the issue is solved at 21:00 when an else statement is added -_- ... Up until you add that else statement, you're not telling the code what to do if there is no movement at all. That's why no sprites were being drawn until you move.
I think my chances of getting an answer are pretty low, but my character's animation when I press the movement key is delayed, and if I just tap the movement key the animation doesn't play at all and my character just hovers around. Is this the same for anybody else or have I made a mistake somewhere and can't find it
@@isaac7253 Did you watch the pinned comment video? she made a mistake in her programming which skipped the last animation and that video corrected it. It was less obvious with an 8 frame animation than it would be with a 4 frame animation.
I like the alternate method, although I have a concern. To be fair, it would probably come up with any kind of player customisation, but because this example uses giant player sprite sheets, it would probably be noticeable earlier on. What is the performance cost of texture page swapping? Obviously, that has more to do with what else is taking up resources at the time, but with this system at a minimum five large sprite pages would be loaded at once, and they're too big to share a page. Depending on the number of NPCs, all of them could be loaded at once and they'd be constant swapping.
Excellent tutorial! Really appreciate you making these videos :) I have a quick question: While going through the tutorial I noticed that my characters flickers (it's like a image refreshing flicker) every time I move. Been looking through the code and comparing and can't seem to find any differences...is there any setting I need to set in gamemaker to stop this from happening?
Thank you! That sounds like the animation is trying to animate one frame too many. This could be due to a missing "-1" or "+1" somewhere, or even the order of things in the code. As you said though, if you've looked through the code and can't see any mistakes then feel free to send me your project file (File -> export project) at friendlycosmonaut@gmail.com, and I can take a look. Sometimes you need a fresh pair of eyes!
Thanks for the fast reply! All is well now; managed to figure out why the sprite was tearing =) For those with the same problem: In the 'Game Options' menu (gear square icon) > Platform Settings > Windows (OR macOS OR Ubuntu) > Graphics > Scaling : set this to 'Full Scale'. Also if that doesn't work, try enabling: 'Interpolate colors between pixels'. Those two settings fixed the tearing =D
I am having an issue with sprites and collision objects and need some help. The sprite is not changing when I attempt to move in the direction of a collision object. For example. I have a collision object. The player object collides with it. I press the input for a different direction and the sprite will change to reflect the new direction, BUT if I use the input to attempt to FACE the collision object afterwards the sprite does not change. I have a debug setup that reports what input the player is using when walking/running etc. It shows that I am moving towards the collision object but the sprite does not change nor increment. I did diagonal movement btw, not four directional.
Hello! Could you please explain how to create subfolders to organize resources? Can't figure it out how you did create "Sprites -> Characters -> Basis"
These are some of the most exciting GM tutorials I've come across so far, and I eagerly await each video. I've been starting with the provided graphics and then replacing them with my own, and because I made the animations myself I noticed that not all frames play. One gets skipped, so I tried adjusting the anim_length to 10 and all frames play but then the sprite disappears for a moment, creating a flashing effect. I slowed down the anim_speed to see what frames are played when you start moving, and it seems to stay on the idle pose like it's the first frame of the animation. I'm an artist trying to learn the development side of things, so I'm not sure what to do to ensure my animations play properly. You are great at explaining things and I would love to hear your take on this. :)
Yeah with our animations the first frame for us is the idle, which we're skipping. So make sure the first frame for your animation is the idle one. I'm not sure if I've understood you 100%, so if you're still having trouble it might be better to show me a screenshot of your sprite so I can see how the frames have been set out.
I have my sprites set up the same way as the ones you're using in the video, with the first frame an idle pose followed by 8 frames of the cycle. The final frame is the one that gets skipped. It's not too noticeable but it gives my animations a bit of a snap to one leg instead of it being smooth for both. I hope that makes sense, I realize I wasn't very clear before.
Ohhh, snap! This is a mistake on my part!! It should be if(x_frame < anim_length - (anim_speed)/60). The reason it was sort of "skipping" a frame was because we told it to go back to the start as soon as it hit the last frame... but that meant the last frame didn't get to play. I should have reorganised the order of the code, the "INCREMENT FRAME FOR ANIMATION" stuff should really be BEFORE we draw the frame. That way we don't even have to deal with the "anim_length - something". So, change your draw event code to this: imgur.com/a/j4zdA Thank you for notifying me of this. I'll make an amendment to the video!
Awesome, that's a great explanation of what was happening. That did fix the frame skipping issue, but I keep having another problem where if I have the anim_speed at anything higher than 6, the sprite disappears for a moment at the end of each cycle. My game frames per second is set to 60, and I have the code you have. Is there another way I should be increasing the animation speed? It looks kind of slow-mo at 6 or less with a run cycle. Sorry to keep asking questions. Keep up the amazing work. I'm off to go watch your most recent video now! :)
Ahh that's a matter of math, darn it! This is my fault again. As an example, say we increment x_frame +0.14 every step. And say we're currently at x_frame = 7.98. According to the check if(x_frame < anim_length), we're still under the max length of 8, so it goes ahead and increments it. Problem is, that means it'll go over to 8.12, which doesn't exist. We should be checking if the NEXT frame is allowed under our system. When it was at 6 (or numbers that are factors of 60), it just so happened that the math would work out to exactly hit 8 (which is not allowed under our system: 60 < 60 fails, because it's not "less than or equal to"). So I'm wrong again -- we DO need to keep the "anim_length - (anim_speed)/60 bit. Or, another way to think of it is: if(x_frame + anim_speed/60 < anim_length). So we're checking if incrementing it is going to make us hit a number we shouldn't. So like this: imgur.com/a/Xuiin Honestly I'm so sorry about this. I should have thought through the logic more with other numbers. I think I'll just make a mini video explaining all of this, as it's a mistake that can slip under the radar, and might be useful for others to see. Thanks so much for being patient with me!
Anyone please help. I can change direction and the animation runs fine however I'm stuck in place. I'm gone over n over and can't figure out where I went wrong. My code matches yours ans still I'm stuck in place. I'm a beginner and I'm pretty lost for the most part.
I downloaded the sprites and it has a bunch of different things but not a complete character ,my question is how do you add say clothes to the sprite of a human since it also has clothes sprites
Yes, in the video I explain how we can use all these different sprite parts (clothes, base, hair) and then layer them on top of each other. This will allow us to "switch" them out later (ie. our characters can change clothes).
Another great video i have feeling i will become your greatest fan. It was amazing work and I have learnt so much from it. I can see how powerful it can be to draw peaces of sprite rather than whole sprite at once and how it can help with making game easier for customization and easier for changes. Do have any professional experience with making games or are you just hobbyist game developer?
I know it's a bit unlikely to get an answer, but I'll ask in hopes. I will preface this by saying, I am very new to coding, I've attempted to google every keyword I can think of, and I am using gamemaker's DnD system. I have not had any trouble converting what is in the tutorial to DnD and ultimately, my game, up until now. I'm trying to trigger an additional animation change when the mouse clicks, to set up to use a tool, later. I've tried several different ways with different issues each time. I have a full 6 frame idle animation if that makes a difference, so I am trying to get when the mouse is released, to finish it's animation sequence and then revert back to the last used idle sequence. The ways I've attempted this and the problems arisen: 1. if mouse click left is held set y_frame +2. This makes it rapidly go through frames until the sprite dissapears 2 If mouse click left is pressed, set y_frame + 2 and set x_frame to 0: if x_frame < anim_length , increment, (like the other animations) : else set y_frame-2 This creates a problem where it then keeps -2 after the end of every animation, so the sprite eventually dissapears. but othewise achieves what I want. 3. setting the click to when it's held down and using numbers instead of a variable, like with the walk animation change, it loops and doesn't return when the button is released 4. Same as above but using underneath each directional change: just uses the last one return number input. Doesn't work at all. I've tried figuring out loops, but they either respond exactly the same as above or the game doesn't run. If anyone could help me figure out what to actually do to have multiple offset animations that only play once, I would be forever grateful
this doesn't work for me, please help! I've done the exact coding but my sprite doesn't animate or even show in the room! (yes I have placed it in the room) Edit: It is something to do with the x_frame and y_frame values because when i change them it will show the sprite but it will only walk left
A few questions from watching this: 1) why not just use the horizontal and vertical *cell* offsets to avoid needing the calculator when doing that first import? GMS2's addition of +/- keys and cell offsets makes this so much easier and more intuitive than in GMS1 where you had to *know* everything or experimentally punch in numbers until something worked. 2) what advantage do you get by manually dividing the sprite at runtime instead of dividing it into frames first and then keeping track of the frame numbers? I'm betting the exact same thing could be done using separate frames, trimming out the blank spaces, and then adding variables for the start and end points of each animation. 3) is this system just intended to maximize the value of limited assets in the trial version, or does it provide some advantage over keeping separate sprites for each animation? Is there any way to detect the available frames for each animation in the sprite, or is that one more thing to build variables to keep track of? 4) when you are doing the math with the sprite cuts, why not use the built-in room_speed instead of a fixed number? Also why do all that math in the draw event when all the documentation says to avoid unnecessary coding in that event? I realize maths are quick to do, but wouldn't you get the same results with better performance by performing all possible calculations in the step event first?
I'm going to preface my answer by saying these are great questions, and most of my answers can be summed up with this: there's lots of ways to do things, I'm just showing one. Because these are tutorials, I'm favoring simplicity and ease of explaining over performance, so there's likely going to be better ways! I'd encourage you to adapt what I do where you see fit. 1) You definitely could, it was more about sharing my own techniques, the flow of the video, and trying to not introduce too many new concepts at once. Basically, it's really hard for me to know "would other people understand this? Am I going too fast?" so I just have to guess. I have a couple people I run my videos by to get a few opinions, but everyone's different. 2) It wasn't actually about game performance -- more about making it easier for us to import lots of assets. Because all of the spritesheets have the same structure, they are all going to work with the system we set up. It also means I only have to import things once instead of multiple times for every animation for every character. 3) Yes, this is definitely trying to reduce the number of assets in our project. There is an advantage in that, now that we've got it all set up, switching animations is going to be relatively easy -- and you can essentially use the exact same thing in every NPC object too. We just have to change the "sprite_base = spr_dog", etc. So it allows us to make new objects quickly. As for detecting the available frames, yes, I think you'd have to use a variable to keep track of it. 4) You could do this! No real reason; in my head, it was an arbitrary choice. As for the math, documentation and the draw event -- putting it in the step event actually wouldn't change anything. I had a similar question about this on another video of mine, and a friend answered it very well: Ariak: "I'm afraid the manual is a bit misleading. All code is executed at the same speed - no matter which event. That said the draw event will typically be the event that takes the longest to execute, simply because we are actively drawing to the screen. They are also the only events that can actually draw to the screen. The reason why the manual still advises against putting too much logic into the draw event is because users are tempted to manipulate instances positions, angles etc etc in the draw event. This can lead to visual unpleasantries if done wrong. A good example would be collisions. Assume instance A moves to a free spot and draws itself. Now instance B comes along and wants to move to the same spot. If your collisions are set up in a way where B can push A you can run into a problem! B moves, pushes A, draws itself. BUT: Instance A is now drawn on the wrong position on the screen! B moved it after it had drawn itself. ... As we have to draw the instances at some point (necessitating a draw event) we might as well pack it all into a single block of code, making it easier to organize the whole system."
Thanks for the quick answer, and those are very good points. Although, for the "import once" thing, you can actually strip-import every frame, delete the blank spaces, and then use that sprite as a base. Duplicate it and remove unneeded frames to cut animations out of the base sprite, and that achieves that particular goal. What it doesn't do, and I can definitely appreciate the value of one cohesive sprite with your multi-part system, is cut the multiple layers down to one sprite each. Anyway, very interesting and thorough tutorial. I may have to consider your sprite sheet method for my own game. Sadly, it's using 3-frame yoyo animations for almost everything and any spritesheet standards it uses are set up by myself, so this would take a bit of editing in any case. The funny thing is, I only found this while looking for a how-to on finding collision with sprites placed directly in the room. I had a crazy idea that the new sprite layer system would give better performance than placing objects and more bounding box control than tile collision for placing things like trees. But my search so far has not been optimistic in that regard, and the help file doesn't even address collision with tiles though I know that can be done. If you've found anything in this regard, I'd appreciate hearing about it.
It's been awhile, but any chance you could elaborate on your statement "GMS2's addition of +/- keys and cell offsets makes this so much easier?" I'm trying to figure out if its possible to access those properties outside of the image editor (i.e., in code) instead of manually counting and multiplying pixels. I've always imported individual strips for each movement but I'm trying out the format in this video. Thanks.
EDIT: Figured it out, I simply autopiloted the sprite import, using another method with single strips. I don't know if you are still active since this is very old, but I ran into a problem using this method. My sprite flickers out as soon as I start to move and never shows anything but the first (0) frame of the animation. When standing still, the first frame is shown. When moving, the character becomes invisible. I have a 12 frame animation and in the animation window it shows all frames from 1- 12 when I hit play, there are no blank frames in between. My anim_lenght variable is set to 12, of course. After checking the code several times, it is identical to yours, otherwise. Could this method got destroyed by a GMS update? That sounds unlikely to me, but I cannot find any solution.
@@Madworld130 Yes. I was simply autopiloting the process and imported the sprites as single _strips as I am used to. After I found this mistake and placed everything in one sprite sheet instead, it worked.
@@ericstephenbrenner Thank you for the update! Mine are in the one sheet though so I'm not sure? The only difference I have compared to the tutorial is that all walking directions are in one line as opposed to four different rows. So same y coordinate, different x. Been wrecking my head all day over it. Gonna give it a break and I'll try again Monday
@@Madworld130 Check if the sprite size in the code and in the sprite editor is the same. It could be that one is 62px and the other one 32px, for example. Also make sure that in your code you reference the correct row in your own sprite sheet. If this fails to return results, double check the whole code for typos. Hopefully this helps.
@@ericstephenbrenner I figured it out. Well, I figured out why it's not working but not how to fix it. Dumb mistake. Because the x frame changes, I've declared it as simply 'if moving left, x frame is 13' but then I use the xframe += later which of course doesn't work because I've already declared it as 13. So just have to figure out how to start it at frame 13 but then have it roll through frams 13 to 19. This literally just occured to me lol I'll figure out a fix tomorrow
My sprite doesn't appear when the game begins. It only moves when I press an arrow key. I believe this is because moving the arrow keys modify moveX and moveY, but I still can't get it to appear right away. I have moved onto other videos and your character shows up on the game start. How did you fix that?
SOLVED: I may have missed it in the videos, but set your obj_player x_frame + y_frame to NON ZERO values so the sprite has something to draw. For Example: x_frame = 1; y_frame = 9;
I am having an issue in getting the bounding box to move with the player. I have looked through the code and set up the collision mask over and over again but the bounding box keeps expanding as i move the player across the screen. Could someone help me out with this, please.
I think I had the same issue. Make sure you've written out your bounding box corners correctly "bbox_left, bbox_top, bbox_right, bbox_bottom". I had accidentally written bbox_right twice, instead of right and bottom.
Hello all! There is a bug in our animation system: the last frame is playing incorrectly. I've made a new video addressing this, so make sure you watch it to update your code. It's a very quick and easy fix: ruclips.net/video/hxKlOlQ7Mdc/видео.html
I'm loving your videos! Keep up the good work.
HeartBeast here?^^
Now we need Shaun Spalding for full team! )))
Nice to see you here
you know the tutorial will be good when makers of other tutorials you like are complementing them! :D
Thanks so much for the support, everyone! I can't help but be a little nervous every time I post a video, but it's so reassuring to read such lovely comments.
I forgot to mention that I've set up a twitter: twitter.com/FCosmonaut. From now on, I'll be posting links there to new videos as soon as they are uploaded.
You are actually the best GM2 Resource out there, please don't stop, I'm relying on you xD
Cheers! I won't stop anytime soon. Although I have to say, there's tonnes of wonderful creators out there for GM2 :). If you're hungry for more content, or just some fellow devs to chat/showcase what you're working on/get help, I'd highly encourage you check out the GameMaker Discord. Here is an invite link (via reddit) if you're interested: www.reddit.com/r/gamemaker/wiki/discord
The more the merrier! :)
The discord is really helpful and has (mods?) as well as other members that help you problem solve in real time issues that you might be having with your code.
it's absolutely INSANE to me that this series doesn't have more views!!! this is hands-down the BEST gamemaker studio tutorial i've found so far, even better than paid ones I've seen, and it's FREE!!! you explain everything so clearly, and you not only show us how to do stuff, but also WHY, which is hugely beneficial. you don't just show us how to build *your* game, but how the different tools work so we can build our own games without just copying someone else's. i'm super super super grateful for this series, it's such a lifesaver, especially given how frustrating it can be trying to delve into video game creation without a background in code. imagine me sending you a bouquet with a thank-you note attached.
Just want to let everyone know, but you can click and drag the pngs into the Sprite groups, and GMS will automatically create the sprites. This works with multiple pngs selected.
In addition, you can click and drag whole folders in, and GMS will generate sprites and groups (based on the folder hierarchy within the dragged folder) automatically!
Is there anyway to turn off them opening automatically?
Wow I wish I had read this before doing each one individually...well now at least I know not to make that mistake again
I just discovered your channel, and after watching s few minutes of your teaching style, I insta-subbed. Excellent work explaining thee whys and hows of your elegant programming style.
Having worked with LPC on my own, this method saves so much work over turning the sprite sheets into strips. With a small team, automating with code is almost always a better solution than manual labor.
On that note GMS 1.x and 2 have a labor saving way of importing lots of sheets or strips at once:
1) Create all the group folders and sub-folders in the sprite tree.
2) Name the sprite sheet and strip files what you want them to be called. (for instance "spr_BaseManDark.png" and "spr_DoorOpen_strip5.png")
3) Just drag and drop them from the file explorer onto the GMS group folder you want them in, and GMS will automagically make the sprite resourse with the file name. Additionally, if its an animation strip and you named the file ending in "_stripX" where X is the number of frames in the file, GMS will automagically break it into that amount of sub-images.
Oh, neat! I didn't know about this. And thank you!
Just wanted to say, this is one of the very rare tutorials I've watched all the way through, instead of just scanning for the information I needed. I really like your tutorial style and appreciate the work you put into these.
Thank you, this is really nice to hear. You're very kind!
They should be giving you buckets of cash for this. They should have this on the front age of their website. I've no doubt you've convinced countless beginners to fork out the cash for the creator version with this video. You've definitely convinced me. You have a talent for teaching, and I appreciate you sharing it with us so much.
This series is AMAZING!! Total package, everything a beginner could want, 10/10! Thank you so much for taking the time to share this series. I absolutely appreciate it.
I don"t need such a beautiful sprite drawing system for my game, but damn, I love how you make your tutorials so much! After Space rocks I passed by other tutorials, but I missed your style of teaching things so much. Thank you! I wish you all the best with all my heart! Don't stop teaching.
I will never look at doing sprites the same way again, I feel like this video will save me sooooo much time in the future!
Very insightful! Thank you for a great tutorial. I really like how you're not trying to cram it all into a shallow 4-minute video but instead devote the time necessary it takes to explain your setup in depth.
This is the best sprite management tutorial for GMS 2 hands down, thanks for showing this layering technique!
I can't believe I have found this tutorial series before, this is exactly the stuff I need for my game and I haven't found anyone else doing this the way I wanted. Thanks so much!
I know I'm really late finding this series, but honestly it's a god send. Very well explained, and very easy to follow. Thank you!
Perfect timing on this series as I just got GMS2 a few weeks ago and intended to make this style game once I learn the language and get a firm grasp of the program. You, heartbeast, and a few others have made the learning process much easier.
Anyone else feel like this is the beginning of something big? :D
Yep
I’m absolutely floored by the quality of these tutorials. They feel so natural and unscripted but move at a great pace with no awkward downtime. It really helps beginners to see and hear the thought process behind working through these solutions. Truly a great teacher!
This tutorial series is amazing and you're amazing, thank you! This is exactly the type of tutorial I've been looking for. I've been slowly teaching myself GM in my free time and guides like your's are a HUGE help. You're awesome
I found that trying to implement your own set(s) of movement after finishing the tutorial was really helpful for solidifying my understanding of the system she set up, and would recommend trying to implement the "death" animation (y_frame = 20) by pressing space bar or something similiar. It also really brings home how powerful / flexible this system is granted you set your sprites up in the appropriate format.
This is a great suggestion - I'm really glad you could expand on it like this :)
This is quite complicated. But it's carefully explained. I'll be rewatching this soon and keeping notes.
This is a really great series, I don't know how you have so few subscribers. Your videos are honestly the most helpful coding tutorials I've ever seen, all of the other ones I've found just dumb a bunch of code on you without really telling you what it's meant to do.
This is seriously one of the best tutorials I've ever seen for anything, gamedev or otherwise. Great work!
This was mind-blowing. You coded this in a much more comprehensive way that I would have ever thought of.
Amazing Tutorials, coming here on and off since about 4 Years, i would not know how to handle GM2 without you!
05:00 we definitly appreciate. Your tutorials rock!
I really appreciate that you are showing us how to get the sprites from a full sprite sheet! :D
Thank you!
Very well made! This is the way it should be done and this is the first video I've seen that I think does it the animation and drawing of sprites effectively! I've recently been building an extension or engine that reads sprite information from a file and draws the sprites in the proper places based on a file in a very similar manor (similar to spine but with multiple directions and easier to change attributes / params for the accessory types). Great Job!
Thank you! Wow that seems like a nifty extension you're building. Hopefully I'll get to see it when you finish it!
Man this is awesome. It's so easy to go through what you are doing. It's all currently working with GMS2 as of Jan 2 2021. I have a game up and it feels good to see this coming through. Thanks for explaining the concepts and what not. It's helping me understand GML.
I know this is old but its still amazing there's so much I've learned from it
Thank you so much for having so many uploads about GMS2. I have literally watched everything HeartBeast has to offer, and its wonderful to get different perspective too! He taught me in a certain way and I am getting a repetition from you using different words. Really helps me to memorize a lot. Thank you so much!
That's so great to hear! I also find that getting different perspectives helps me learn too. :)
Great job! Best help on the net. I love your explanation. the speed. Your voice. Everything. Very well done.
Cheers! :)
This tutorial series is fantastic. Thank you so much for spending the time to put this together, it's absolutely invaluable!
Thank you! No worries at all, I'm really enjoying it :)
wicked! How long have you been coding for? Do you do it professionally? Im a 3d environment artist professionally but would love to make my own games in my spare time. Coding is just such a huge mountain to climb!
Hehe no, not professionally! Basically I've dipped my toes in coding waters at a few points over my life (for school, data analysis, and then as a hobby), but I probably only *properly* started coding about a year ago. And I can say from my small amount of experience that although it may seem daunting at first, you can learn a lot fast, and I have to say GameMaker is ideal for this. And programming is SUCH satisfying work.
So if you're keen and starting out, I can recommend: consume a LOT of tutorials, become best friends with the documentation (middle click on a function every time you learn a new one/forget what something does), make mistakes, and solve lots and lots of errors. Programming is tonnes of fun :)
I added in all the assets for the player character and it made the collision stop working and then now i have the yellow box leaving a trail everywhere, great videos! maybe im not the best at following
I've learned more in your videos than in most of the tutorials I've seen, thanks a lot and I hope you continue with your tutorials for a long time
Thank you so much for these videos! I have been wanting to make a game for a while but had trouble getting my head around the programming. But, you are making it seem possible!
You're welcome! I'm really glad to hear it - good luck with your programming journey :)
I didn't know about the 'Draw_Sprite_Part' function. Thank you so much. :)
It's really so helpful and I'm so grateful for your work! I dont know tutorial better than this one.
wow that was a beautiful drawing system.
After some months looking into game dev I just realized I'm still just a beginner which is good because the solutions for the problems I'm facing can be done beautifully, like here.
Thanks for the videos.
Subscribed!
ps: as mentioned by your community you have a rly good teaching method :)
Cheers! Really glad the videos have helped :)
Holy Hell I wish I found your video first. This is amazing advise
Cheers for this.! Again, Brilliant tutorial! ..
You were talking about making your spritesheets smaller at the end, GMS makes its own spritesheets at compile time of the only sprites you use ..
So GMS essentially makes them smaller for you anyway ...
I'm not sure I understand -- I meant if you're using a large spritesheet in the way we are, but don't end up using everything on it, we might as well get rid of those sections. GMS would be grabbing the whole sprite sheet, wouldn't it? Or did you mean the "space" between the frames? (And thank you!)
3:06 such a beautiful moment
Thanks for sharing this sprite sheet method. I've always wondered why sometimes they come in giant sheet form.
Cheers! Yeah -- GameMaker has a great, intuitive "one sprite at a time" system, but due to the sprite constraints in the trial version, and just that it's fun to try something new, I thought I'd showcase another way of doing things. Glad you enjoyed it!
I always come by to drop a like when I see your videos are up. Not using them right now, but I will take a look at them in the future. Loved your depth tutorial and will def check out your text box tutorial. The only suggestion I have is to add a subtext or episode number to your thumbnails, to better distinguish between them. Otherwise, I like how the thumbnails look for this Farming RPG series. Keep up the good work!
Thanks a lot :)! I liked your suggestion and have updated the thumbnails; it's nice and easy to do, and makes it easier to distinguish them visually. So thank you!
You made me buy GMS 2 :)
Wow! Awesome, I hope you have lots of fun with it. I definitely enjoy it a lot more than GMS 1.
I learn new ways of doing things in gamemaker! Thanks!
No worries! Glad to help.
If i found this helpfull ? I start to the real 0 skill in coding and programing and your video are really usefull, i start to understand the logic and avoid basic mistake.
Eeee!!! Thank you so much for this video. I've been stewing on an Animal Crossing style game for a while now but never really understood how it should be set up... This video has been so helpful!
Awesome!! I'm glad it helped. I absolutely adore Animal Crossing and would love to see more games like it, so good luck!
These are utterly fantastic -- keep up the excellent work!
Man I wish I found this video last year, I spent months upon months importing all the different sprite sheets from the LPC collection, I only managed to get around 300+ sprite sheets done, but I decided to change the colour of the sprites (Where possible) in game maker to be able to minimize the amount of importing I was doing.
30:13
FriendlyCosmonaut
I followed everything you did but with the outline; it's like a vertical box that increases and decreases in size (vertically) based on movement of the sprite. Moving left makes the mask go above the character and moving right makes it go below. I honestly have no clue what I missed or anything because I followed you to the T.
Thanks!
If you're still having problems with this could you reply with the snipit of your code thats causing you problems, i've been going through the series just recently and maybe could lend a hand.
Great work! :) im develop on swift 3 right now and every tutorial it's useful :)
If someday I release my game I'll be very proud on putting your name on the credits as Special Thanks
Absolutely incredible. Excellent video!
Is there a reason to use sprite_get_xoffset() function instead of sprite_xoffset variable? I thought that sprite_xoffset would be more appropriate since it already takes into account the x_scale property.
21:00 (if u wanna make stop movment event ) thats what i was looking for THANKS!!!
hi. I got a little problem. my Characters dont show up unitl I press a arrow key / move the character. anyone knows a solution?
I know its been a few months, but did you manage to fix this? I have the same problem and I can't see what needs changing.
See if x_frame is set to 0. If it is set it to 1
i have a problem, when the game starts the character is not drawn, but when i move it draws the character
Thank you for another informative lesson!
FriendlyCosmonaut, Heartbest, Shaun Spalding collab would be amazing!
Heres a tip for anyone who doesn't understand what the code does.
For each frame write down what each variable is equal to. Do the math on paper.
For example, to better understand this video i wrote down what frame_x would equal after adding anim_spd/60 to it. This helped me to better understand the logic behind the animation speed. (More specifically, the floor(frame_x)*frame_size bit)
I rewatched the bit where you added the floor function, and you perfectly describe what's happening. I must've lost focus the first time i watched it. Still, I stand by my advice.
And thanks for the tips you gave me yesterday. I plan on being persistent and using every resource available - as well as partaking in the Game Jams.
Thanks for the work that you do!
Great advice. To really what we're doing here, you really do have to step through some of the math yourself. Thanks for sharing!
Thank you for the lovely tutorial! I'm trying to make a retro rpg with grid based movement (with animation going on while moving), I'm struggling on figuring out what to change to make that possible with this code. Any advice would be greatly appreciated!
So I build my own character customizer. I utilized the logic you showed but now I have an invisible moving sprite :( both independently work but I can’t seem to get it to work for both at the same time
I know I'm late, but my character won't animate at all? It will keep a still frame. Im at 18:30. I copied what you did but to no avail. help?
(edit): I got the animations working, but of them makes my character invisible?
I had this same problem. Most likely x_frame is getting too large like what happened with me and so there is no sprite and the character becomes invisible. Think of x_frame as a panel or page number rather than the x coordinate of where you want it. So x_frame should never be greater than 9 in this sprite sheet, 1 would be the second sprite, 2 the third etc.
Thank you so much for these videos! I am having an issue with the animation of my sprite. The animation plays fine but something is off and a line appears to move through the sprite at the last frame. Something seems offset but i cant find where it happens.
So, I'm trying to add in my own sprite sheet using the same concept- 64x64 boxes, but my sprite sheet is smaller (so the walking anims aren't halfway down the sheet, they're at the top). But, changing the numbers (the 8 through 11 to show where it's getting the sprite from), but doing so makes the sprite, say, walk up but facing to the left. I can't quite figure out how to fix it. I can usually get one or two going the right way.
Edit: I figured it out, sorry. I didn't realize the first row doesn't get counted (if you mentioned, I didn't notice, again, sorry!) But shifting everything down out of that first row fixed my problem right up.
Delayed comment, and I realise you found a fix for yourself, but, remember that in programming a lot of the time 0 is the first value, not 1. So that might be why you found it doesn't read the "first row". 😀
I'm loving your videos so much.
Thank you :)!
Great video! Tons of important information and presented very clearly.
Do the multiple draw_sprite_part calls per character hurt the performance? I'm think especially when played on less powerful phones.
Thanks so much for your hard work on these tuts!
Can't wait for the next video!
hi i have a problem i wrote the code same your code and used the same code and same png
when i use this code (else x_frame = 0;) the charecter stop animated to right and left but keep moving to right and left seems it like drage it
So... my collision box seems to be anchored in one place, and grows and shrinks as my character moves around.
Can't seem to find the problem - any ideas? (I'll keep looking though)
Here's my code in the step event, by the way. I suspect the problem is here somewhere.
/// @desc Move & Check Collissions
//--------------UPDATE INPUT
input_left = keyboard_check(vk_left);
input_right = keyboard_check(vk_right);
input_up = keyboard_check(vk_up);
input_down = keyboard_check(vk_down);
input_walk = keyboard_check(vk_control);
input_run = keyboard_check(vk_shift);
//-----------ALTER SPEED
if (input_walk or input_run) {
spd = abs ((input_walk*w_spd) - (input_run*r_spd));
}
else
{ spd = n_spd; }
//-----------RESET MOVE VARIABLES
moveX = 0;
moveY = 0;
//--------------INTENDED MOVEMENT
moveX = (input_right - input_left) * spd;
if (moveX == 0) {moveY = (input_down - input_up) * spd;}
//----------------COLLISION CHECKS
//--------Horizontal
if (moveX != 0) {
if (place_meeting(x+moveX, y, obj_collission)){
repeat (abs(moveX)) {
if (!place_meeting(x+sign(moveX), y, obj_collission)) { x += sign(moveX); }
else { break; }
}
moveX = 0;
}
}
//--------Vertical
if (moveY != 0) {
if (place_meeting(x, y+moveY, obj_collission)){
repeat (abs(moveY)) {
if (!place_meeting(x, y+sign(moveY), obj_collission)) { y += sign(moveY); }
else { break; }
}
moveY = 0;
}
}
//----------------APPLY MOVEMENT
x += moveX;
y += moveY;
So I'm actually having an issue with the draw_sprite_part function following your tutorial. I'm a little bit further than this point, but when I start the game, none of the character sprites are drawn until they move. Can anyone help me figure out what my issue might be? I can send the code too if that would help.
You've probably solved this by now but just adding a comment in case it helps someone. I was having the same issue halfway through the video, and eventually I was able to solve the problem myself, so then I went back to the video - very proud of myself - only to discover that the issue is solved at 21:00 when an else statement is added -_- ... Up until you add that else statement, you're not telling the code what to do if there is no movement at all. That's why no sprites were being drawn until you move.
I like very much the way you explain and teach
Great stuff - Thank you so much!
Thank you SO much for making these videos!!
I think my chances of getting an answer are pretty low, but my character's animation when I press the movement key is delayed, and if I just tap the movement key the animation doesn't play at all and my character just hovers around. Is this the same for anybody else or have I made a mistake somewhere and can't find it
If anybody else has this issue I fixed it by doing two things:
1. I added the code
if(moveX != 0) and (x_frame
@@isaac7253 Did you watch the pinned comment video? she made a mistake in her programming which skipped the last animation and that video corrected it. It was less obvious with an 8 frame animation than it would be with a 4 frame animation.
Thanks for all your hard work on these videos! You're really good at this :) A joy to learn from.
I like the alternate method, although I have a concern. To be fair, it would probably come up with any kind of player customisation, but because this example uses giant player sprite sheets, it would probably be noticeable earlier on.
What is the performance cost of texture page swapping? Obviously, that has more to do with what else is taking up resources at the time, but with this system at a minimum five large sprite pages would be loaded at once, and they're too big to share a page. Depending on the number of NPCs, all of them could be loaded at once and they'd be constant swapping.
I could not possibly subscribe quickly enough.
Excellent tutorial! Really appreciate you making these videos :)
I have a quick question: While going through the tutorial I noticed that my characters flickers (it's like a image refreshing flicker) every time I move. Been looking through the code and comparing and can't seem to find any differences...is there any setting I need to set in gamemaker to stop this from happening?
Thank you! That sounds like the animation is trying to animate one frame too many. This could be due to a missing "-1" or "+1" somewhere, or even the order of things in the code.
As you said though, if you've looked through the code and can't see any mistakes then feel free to send me your project file (File -> export project) at friendlycosmonaut@gmail.com, and I can take a look. Sometimes you need a fresh pair of eyes!
Thanks for the fast reply! All is well now; managed to figure out why the sprite was tearing =)
For those with the same problem: In the 'Game Options' menu (gear square icon) > Platform Settings > Windows (OR macOS OR Ubuntu) > Graphics > Scaling : set this to 'Full Scale'. Also if that doesn't work, try enabling: 'Interpolate colors between pixels'. Those two settings fixed the tearing =D
Huh, that's interesting! I think I've actually had the same inexplicable problem a few months ago.
loving your videos! and a little question need help pls!! how to add 4 direction idle animation when my character stop with this DRAW system?
My “up” movement sprite is at 0 but when I put that in the code and try to play it uses the “down” animation. Any help?
I am trying to do your tutorial, but I cannot find the first character on OpenGameArt.
Could you please help me ?
Moritz (11 years old)
Great stuff, keep it up!
Excellent videos! Nice work :)
Can this be skipped and added later?
This is so great! Thankyou very much!
I am having an issue with sprites and collision objects and need some help. The sprite is not changing when I attempt to move in the direction of a collision object. For example. I have a collision object. The player object collides with it. I press the input for a different direction and the sprite will change to reflect the new direction, BUT if I use the input to attempt to FACE the collision object afterwards the sprite does not change. I have a debug setup that reports what input the player is using when walking/running etc. It shows that I am moving towards the collision object but the sprite does not change nor increment. I did diagonal movement btw, not four directional.
I resolved this issue by adding an expression to the sprite change -
if (moveX < 0 || input_left) sprY_frame = 9;
else if (moveX > 0 || input_right) sprY_frame = 11;
else if (moveY < 0 || input_up) sprY_frame = 8;
else if (moveY > 0 || input_down) sprY_frame = 10;
Btw she completely changes the code for this in a few videos so you can prob ignore this
Hello! Could you please explain how to create subfolders to organize resources? Can't figure it out how you did create "Sprites -> Characters -> Basis"
These are some of the most exciting GM tutorials I've come across so far, and I eagerly await each video. I've been starting with the provided graphics and then replacing them with my own, and because I made the animations myself I noticed that not all frames play. One gets skipped, so I tried adjusting the anim_length to 10 and all frames play but then the sprite disappears for a moment, creating a flashing effect. I slowed down the anim_speed to see what frames are played when you start moving, and it seems to stay on the idle pose like it's the first frame of the animation. I'm an artist trying to learn the development side of things, so I'm not sure what to do to ensure my animations play properly. You are great at explaining things and I would love to hear your take on this. :)
Yeah with our animations the first frame for us is the idle, which we're skipping. So make sure the first frame for your animation is the idle one.
I'm not sure if I've understood you 100%, so if you're still having trouble it might be better to show me a screenshot of your sprite so I can see how the frames have been set out.
I have my sprites set up the same way as the ones you're using in the video, with the first frame an idle pose followed by 8 frames of the cycle. The final frame is the one that gets skipped. It's not too noticeable but it gives my animations a bit of a snap to one leg instead of it being smooth for both. I hope that makes sense, I realize I wasn't very clear before.
Ohhh, snap! This is a mistake on my part!! It should be if(x_frame < anim_length - (anim_speed)/60). The reason it was sort of "skipping" a frame was because we told it to go back to the start as soon as it hit the last frame... but that meant the last frame didn't get to play.
I should have reorganised the order of the code, the "INCREMENT FRAME FOR ANIMATION" stuff should really be BEFORE we draw the frame. That way we don't even have to deal with the "anim_length - something". So, change your draw event code to this:
imgur.com/a/j4zdA
Thank you for notifying me of this. I'll make an amendment to the video!
Awesome, that's a great explanation of what was happening. That did fix the frame skipping issue, but I keep having another problem where if I have the anim_speed at anything higher than 6, the sprite disappears for a moment at the end of each cycle. My game frames per second is set to 60, and I have the code you have. Is there another way I should be increasing the animation speed? It looks kind of slow-mo at 6 or less with a run cycle.
Sorry to keep asking questions. Keep up the amazing work. I'm off to go watch your most recent video now! :)
Ahh that's a matter of math, darn it! This is my fault again. As an example, say we increment x_frame +0.14 every step. And say we're currently at x_frame = 7.98. According to the check if(x_frame < anim_length), we're still under the max length of 8, so it goes ahead and increments it. Problem is, that means it'll go over to 8.12, which doesn't exist. We should be checking if the NEXT frame is allowed under our system. When it was at 6 (or numbers that are factors of 60), it just so happened that the math would work out to exactly hit 8 (which is not allowed under our system: 60 < 60 fails, because it's not "less than or equal to").
So I'm wrong again -- we DO need to keep the "anim_length - (anim_speed)/60 bit. Or, another way to think of it is:
if(x_frame + anim_speed/60 < anim_length). So we're checking if incrementing it is going to make us hit a number we shouldn't.
So like this: imgur.com/a/Xuiin
Honestly I'm so sorry about this. I should have thought through the logic more with other numbers. I think I'll just make a mini video explaining all of this, as it's a mistake that can slip under the radar, and might be useful for others to see. Thanks so much for being patient with me!
Anyone please help. I can change direction and the animation runs fine however I'm stuck in place. I'm gone over n over and can't figure out where I went wrong. My code matches yours ans still I'm stuck in place. I'm a beginner and I'm pretty lost for the most part.
I downloaded the sprites and it has a bunch of different things but not a complete character ,my question is how do you add say clothes to the sprite of a human since it also has clothes sprites
Yes, in the video I explain how we can use all these different sprite parts (clothes, base, hair) and then layer them on top of each other. This will allow us to "switch" them out later (ie. our characters can change clothes).
But if you just wanted a complete sprite you can use the "online character creator" link to make the character, and then download that sprite sheet.
Another great video i have feeling i will become your greatest fan. It was amazing work and I have learnt so much from it. I can see how powerful it can be to draw peaces of sprite rather than whole sprite at once and how it can help with making game easier for customization and easier for changes.
Do have any professional experience with making games or are you just hobbyist game developer?
So glad you found the video helpful! Nah not a professional - I'm just a hobbyist :)
I know it's a bit unlikely to get an answer, but I'll ask in hopes.
I will preface this by saying, I am very new to coding, I've attempted to google every keyword I can think of, and I am using gamemaker's DnD system.
I have not had any trouble converting what is in the tutorial to DnD and ultimately, my game, up until now.
I'm trying to trigger an additional animation change when the mouse clicks, to set up to use a tool, later.
I've tried several different ways with different issues each time.
I have a full 6 frame idle animation if that makes a difference, so I am trying to get when the mouse is released, to finish it's animation sequence and then revert back to the last used idle sequence.
The ways I've attempted this and the problems arisen:
1. if mouse click left is held set y_frame +2. This makes it rapidly go through frames until the sprite dissapears
2 If mouse click left is pressed, set y_frame + 2 and set x_frame to 0: if x_frame < anim_length , increment, (like the other animations) : else set y_frame-2 This creates a problem where it then keeps -2 after the end of every animation, so the sprite eventually dissapears. but othewise achieves what I want.
3. setting the click to when it's held down and using numbers instead of a variable, like with the walk animation change, it loops and doesn't return when the button is released
4. Same as above but using underneath each directional change: just uses the last one return number input. Doesn't work at all.
I've tried figuring out loops, but they either respond exactly the same as above or the game doesn't run.
If anyone could help me figure out what to actually do to have multiple offset animations that only play once, I would be forever grateful
Hi, first of all, thanks for the very detailed videos! Do you know why my character is flashing for a split second when I move him around?
this doesn't work for me, please help! I've done the exact coding but my sprite doesn't animate or even show in the room! (yes I have placed it in the room)
Edit: It is something to do with the x_frame and y_frame values because when i change them it will show the sprite but it will only walk left
A few questions from watching this:
1) why not just use the horizontal and vertical *cell* offsets to avoid needing the calculator when doing that first import? GMS2's addition of +/- keys and cell offsets makes this so much easier and more intuitive than in GMS1 where you had to *know* everything or experimentally punch in numbers until something worked.
2) what advantage do you get by manually dividing the sprite at runtime instead of dividing it into frames first and then keeping track of the frame numbers? I'm betting the exact same thing could be done using separate frames, trimming out the blank spaces, and then adding variables for the start and end points of each animation.
3) is this system just intended to maximize the value of limited assets in the trial version, or does it provide some advantage over keeping separate sprites for each animation? Is there any way to detect the available frames for each animation in the sprite, or is that one more thing to build variables to keep track of?
4) when you are doing the math with the sprite cuts, why not use the built-in room_speed instead of a fixed number? Also why do all that math in the draw event when all the documentation says to avoid unnecessary coding in that event? I realize maths are quick to do, but wouldn't you get the same results with better performance by performing all possible calculations in the step event first?
I'm going to preface my answer by saying these are great questions, and most of my answers can be summed up with this: there's lots of ways to do things, I'm just showing one. Because these are tutorials, I'm favoring simplicity and ease of explaining over performance, so there's likely going to be better ways! I'd encourage you to adapt what I do where you see fit.
1) You definitely could, it was more about sharing my own techniques, the flow of the video, and trying to not introduce too many new concepts at once. Basically, it's really hard for me to know "would other people understand this? Am I going too fast?" so I just have to guess. I have a couple people I run my videos by to get a few opinions, but everyone's different.
2) It wasn't actually about game performance -- more about making it easier for us to import lots of assets. Because all of the spritesheets have the same structure, they are all going to work with the system we set up. It also means I only have to import things once instead of multiple times for every animation for every character.
3) Yes, this is definitely trying to reduce the number of assets in our project. There is an advantage in that, now that we've got it all set up, switching animations is going to be relatively easy -- and you can essentially use the exact same thing in every NPC object too. We just have to change the "sprite_base = spr_dog", etc. So it allows us to make new objects quickly. As for detecting the available frames, yes, I think you'd have to use a variable to keep track of it.
4) You could do this! No real reason; in my head, it was an arbitrary choice. As for the math, documentation and the draw event -- putting it in the step event actually wouldn't change anything. I had a similar question about this on another video of mine, and a friend answered it very well:
Ariak:
"I'm afraid the manual is a bit misleading. All code is executed at the same speed - no matter which event.
That said the draw event will typically be the event that takes the longest to execute, simply because we are actively drawing to the screen. They are also the only events that can actually draw to the screen.
The reason why the manual still advises against putting too much logic into the draw event is because users are tempted to manipulate instances positions, angles etc etc in the draw event. This can lead to visual unpleasantries if done wrong.
A good example would be collisions. Assume instance A moves to a free spot and draws itself. Now instance B comes along and wants to move to the same spot. If your collisions are set up in a way where B can push A you can run into a problem! B moves, pushes A, draws itself. BUT: Instance A is now drawn on the wrong position on the screen! B moved it after it had drawn itself.
...
As we have to draw the instances at some point (necessitating a draw event) we might as well pack it all into a single block of code, making it easier to organize the whole system."
Thanks for the quick answer, and those are very good points. Although, for the "import once" thing, you can actually strip-import every frame, delete the blank spaces, and then use that sprite as a base. Duplicate it and remove unneeded frames to cut animations out of the base sprite, and that achieves that particular goal. What it doesn't do, and I can definitely appreciate the value of one cohesive sprite with your multi-part system, is cut the multiple layers down to one sprite each.
Anyway, very interesting and thorough tutorial. I may have to consider your sprite sheet method for my own game. Sadly, it's using 3-frame yoyo animations for almost everything and any spritesheet standards it uses are set up by myself, so this would take a bit of editing in any case. The funny thing is, I only found this while looking for a how-to on finding collision with sprites placed directly in the room. I had a crazy idea that the new sprite layer system would give better performance than placing objects and more bounding box control than tile collision for placing things like trees. But my search so far has not been optimistic in that regard, and the help file doesn't even address collision with tiles though I know that can be done. If you've found anything in this regard, I'd appreciate hearing about it.
It's been awhile, but any chance you could elaborate on your statement "GMS2's addition of +/- keys and cell offsets makes this so much easier?"
I'm trying to figure out if its possible to access those properties outside of the image editor (i.e., in code) instead of manually counting and multiplying pixels. I've always imported individual strips for each movement but I'm trying out the format in this video. Thanks.
EDIT: Figured it out, I simply autopiloted the sprite import, using another method with single strips.
I don't know if you are still active since this is very old, but I ran into a problem using this method. My sprite flickers out as soon as I start to move and never shows anything but the first (0) frame of the animation. When standing still, the first frame is shown. When moving, the character becomes invisible. I have a 12 frame animation and in the animation window it shows all frames from 1- 12 when I hit play, there are no blank frames in between. My anim_lenght variable is set to 12, of course. After checking the code several times, it is identical to yours, otherwise. Could this method got destroyed by a GMS update? That sounds unlikely to me, but I cannot find any solution.
I am having the same problem. Did you ever find a solution?
@@Madworld130 Yes. I was simply autopiloting the process and imported the sprites as single _strips as I am used to. After I found this mistake and placed everything in one sprite sheet instead, it worked.
@@ericstephenbrenner Thank you for the update! Mine are in the one sheet though so I'm not sure? The only difference I have compared to the tutorial is that all walking directions are in one line as opposed to four different rows. So same y coordinate, different x. Been wrecking my head all day over it. Gonna give it a break and I'll try again Monday
@@Madworld130 Check if the sprite size in the code and in the sprite editor is the same. It could be that one is 62px and the other one 32px, for example.
Also make sure that in your code you reference the correct row in your own sprite sheet.
If this fails to return results, double check the whole code for typos.
Hopefully this helps.
@@ericstephenbrenner I figured it out. Well, I figured out why it's not working but not how to fix it. Dumb mistake. Because the x frame changes, I've declared it as simply 'if moving left, x frame is 13' but then I use the xframe += later which of course doesn't work because I've already declared it as 13. So just have to figure out how to start it at frame 13 but then have it roll through frams 13 to 19.
This literally just occured to me lol I'll figure out a fix tomorrow
My sprite doesn't appear when the game begins. It only moves when I press an arrow key. I believe this is because moving the arrow keys modify moveX and moveY, but I still can't get it to appear right away. I have moved onto other videos and your character shows up on the game start. How did you fix that?
SOLVED: I may have missed it in the videos, but set your obj_player x_frame + y_frame to NON ZERO values so the sprite has something to draw.
For Example:
x_frame = 1;
y_frame = 9;
Yes this has to do with what you set those values to initially - apologies that I didn't stress this in the video. Great solve!
I am having an issue in getting the bounding box to move with the player. I have looked through the code and set up the collision mask over and over again but the bounding box keeps expanding as i move the player across the screen. Could someone help me out with this, please.
I think I had the same issue. Make sure you've written out your bounding box corners correctly "bbox_left, bbox_top, bbox_right, bbox_bottom". I had accidentally written bbox_right twice, instead of right and bottom.
@@jessicalwolff THANK YOU! I was losing my mind trying to get this to work