[GameMaker Tutorial] Zelda Hearts + For Loops

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024

ความคิดเห็น • 126

  • @jeffreycrane8298
    @jeffreycrane8298 9 ปีที่แล้ว +8

    Hi Ben! I just wanted to say that I REALLY appreciated the change you're making by introducing "the challenge"!
    I paused the video, and did the code myself, and it worked perfectly (although I set the alpha to 1, which made them black, not grey).
    I like learning, and while the video's provide that, they don't necessarily "challenge" me to stretch my abilities, but challenge certainly did!
    Thanks!

  • @LockMakesStuff
    @LockMakesStuff 9 ปีที่แล้ว +4

    The Legend of Zelda is my favorite game series of all time, so I really enjoyed this video! :)

  • @HalkerVeil
    @HalkerVeil 9 ปีที่แล้ว

    I was about to comment to say you should add the 'For Loops' in the title. But I see you already did.
    I see so many other tutorials out there that teach many things beyond what their title suggests. Making it difficult to hunt down that one thing I need to brush up on.
    Glad to see you are one of those that puts more thought into the video title.
    Your 'pause challenges' are a great addition to the format I think. Especially with it being near the end when you go over a method you just talked about. Haven't seen anyone do that before. Useful for new learners yet still doesn't get in the way for advanced users who can see the method in their head. And it doesn't break the flow in the video. So we can still watch straight through it just to see how your method works over ours. And there is no waiting for a second video to see how we did.

  • @kailee87
    @kailee87 9 ปีที่แล้ว +17

    U r always the best..plz never stop ur awesomeness job

  • @LordKurtulmak
    @LordKurtulmak ปีที่แล้ว

    Thank you for the primer on for loops, been a long time since I did this and it was hard to find someone to explain it!

  • @hrp127
    @hrp127 8 หลายเดือนก่อน

    its almost 9 years old but still a super helpful video. thank you

  • @osonegroisdabesschickeneat3492
    @osonegroisdabesschickeneat3492 9 ปีที่แล้ว +1

    That little challenge was really cool! You should definitely do more of those.

  • @blacktopballer7385
    @blacktopballer7385 2 ปีที่แล้ว

    Thanks for your tutorials. They are much appreciated

  • @vinnymac5820
    @vinnymac5820 9 ปีที่แล้ว +11

    you've just earned yourself a sub.

    • @uheartbeast
      @uheartbeast  9 ปีที่แล้ว +2

      vinny mac Thanks :D

    • @vinnymac5820
      @vinnymac5820 9 ปีที่แล้ว +1

      :o

    • @chrisrosa5382
      @chrisrosa5382 8 ปีที่แล้ว

      fuck you doesnt work

    • @johnpanozzo1457
      @johnpanozzo1457 7 ปีที่แล้ว

      wow

    • @RLCR_MUSIC
      @RLCR_MUSIC 7 ปีที่แล้ว

      well if it dosent work its because you maybe typed something wrong =)

  • @Kuroi
    @Kuroi 9 ปีที่แล้ว

    man, thanks so much, thanks to you and your amazing tutorials i was able to understand and comprehend ds_grids and now i am able to do my own systems with them and interact with them my own way, i also learned a lot about pixel art, most of what i get from now on on this career(i am a game designer student at university) i own to you, i am not kidding when i say i learned more from you than from most of my teachers

  • @spokenolive6769
    @spokenolive6769 8 ปีที่แล้ว

    These videos are so amazing. Thank you so much for doing these! You not only make it easy to learn to make video games, but you make it fun to learn the art of coding. Keep it up man!

  • @MrCrisMr
    @MrCrisMr 5 ปีที่แล้ว +1

    for those who is asking for half hearts
    for(var i = 0; i

  • @damian8590
    @damian8590 7 ปีที่แล้ว +1

    that for loop is genius, subbed

  • @yassokyassok5243
    @yassokyassok5243 9 ปีที่แล้ว

    HeartBeast Ben thx so much ur the best teacher i have ever had. u rlly make awesome and useful stuff . i have a suggestion if u can make d &d tutos. Any way stay the best

  • @x18percent
    @x18percent 9 ปีที่แล้ว

    Thanks, I appreciate it! I've had an idea for a game and I want to use Game Maker but GML is really intimidating but your tutorials really help! :D

  • @EngineerZGames
    @EngineerZGames 7 ปีที่แล้ว

    Very useful tutorial! I use this system for my pixel art jungle platform game with crafting and survival elements :)

  • @coregg3841
    @coregg3841 8 ปีที่แล้ว

    Thanks man - your videos made my code skills a lot better

  • @soveryme8127
    @soveryme8127 2 ปีที่แล้ว

    Amazing tutorial man, thank you so much

  • @kherrykandy3790
    @kherrykandy3790 9 ปีที่แล้ว

    I was wondering if you could do a video on knock-back. It would be very helpful if you did.

  • @Jexy_LumiKhoth
    @Jexy_LumiKhoth 9 ปีที่แล้ว +1

    Ok so, after watching this video and trying out the code myself, I'm a little confused, mainly because Game Maker wont seem to add more of the health sprites I made properly. Here's the code I have as it currently is:
    var xoffset = 24
    for (var i = 0; i < global.Hearts; i++)
    {
    draw_sprite(spr_Health, global.Hearts (because I want to use subimages for the health to represent three quarters, half heart etc.), xstart+(xoffset*i), ystart);
    }
    When I run the game, I either get one of two results which...well, depends on what I change when trying to figure this out. The first heart will be drawn in the right place, but when more hearts are added, they're added over top the old one. Other times, I'll have four hearts upon start up all of them nearly overlapping each other. When health is taken away, one heart is removed completely, and the other three go to the next subimage. Also if I add another heart to that, I end up with eight hearts all nearly overlapping each other.

  • @DoctorLatch
    @DoctorLatch 8 ปีที่แล้ว +2

    Just to sort of expound on this, I went ahead and found a way to make the hearts appear in rows after a certain number of them, just to give it a more "Zelda" feel.
    Code here: pastebin.com/7JaaQC64
    I still haven't found a good way of making the hearts disappear in sections, but I'm still working on it!

  • @Jt9393synyster
    @Jt9393synyster 6 ปีที่แล้ว

    You're such a genius man

  • @RandomTot
    @RandomTot 7 ปีที่แล้ว

    Awesome tutorial

  • @brecoldyls
    @brecoldyls 7 ปีที่แล้ว

    I watched a bit of this but then figured out how to do it myself by instead simply making the heart sprites and using a draw GUI event in the player object to draw them instead of making a new object to store the player's stats. This way the GUI doesn't have to be persistent, after all I wouldn't want them displayed on the screen while the player is on a screen that the player object is not present on.

  • @enclavecafe
    @enclavecafe 8 ปีที่แล้ว +2

    How would you combine this with enemy collision? Since you haven't given the player hp, I'm not sure how to subtract hp when the player collides with said enemy, and for that matter how, if hp reaches 0, you would lose and the game would close.

  • @devinkrike5968
    @devinkrike5968 9 ปีที่แล้ว +6

    wouldn't this code be better? it uses only 1 for loop statement.
    for(var i=0;i

    • @uheartbeast
      @uheartbeast  9 ปีที่แล้ว +3

      Devin Krike That is a great way of doing it! I used two for loops for teaching purposes (mini challenge and all) But you are quite correct. The difference will be slight but I think that is a more optimized way of doing it.

  • @proximasilver8354
    @proximasilver8354 4 ปีที่แล้ว

    You're awesome! Thanks for this!

  • @larryteslaspacexboringlawr739
    @larryteslaspacexboringlawr739 9 ปีที่แล้ว

    thank you for gamemaker tutorial

  • @blazing_aura4940
    @blazing_aura4940 7 ปีที่แล้ว

    Hi, I tried to implement the code you've used, but instead used it as an ammo bar for my character. It works in all aspects, however when I press the key I binded to shoot/get rid of one of the ammo symbols, it's gets rid of all of them, not just one. Hope you can help. Thanks in advance!

  • @LiamDoesProgramming
    @LiamDoesProgramming 9 ปีที่แล้ว +4

    15:45 i

    • @uheartbeast
      @uheartbeast  9 ปีที่แล้ว +4

      LiamDoesProgramming Shhhhhhh

    • @LiamDoesProgramming
      @LiamDoesProgramming 9 ปีที่แล้ว

      HeartBeast uhhh, please don't kill me D: P.s. when will you start the pokemon like series lol (assuming after the random level gen which I'm really hyped about)

  • @Juke172
    @Juke172 9 ปีที่แล้ว

    I tried to make the hearts animate, but it didn't work. I tried using "image_speed = 1;" and in step event even add "image_index ++; " But it doesn't work. Is it because it's drawn in GUI? huh.. Can't you animate draw GUI? Should I make the whole code inside Draw event instead and make it follow the view? My heart sprite has 4 frames.

  • @XY-op4tn
    @XY-op4tn 8 ปีที่แล้ว +2

    Hello,
    How can we combine this systeme with ur 'rpg maker for beginner' ( episode 21) ?

  • @osonegroisdabesschickeneat3492
    @osonegroisdabesschickeneat3492 9 ปีที่แล้ว +2

    var i=0; i

  • @RandomTot
    @RandomTot 7 ปีที่แล้ว +1

    I Love gamemaker

  • @0NYXSH3LL
    @0NYXSH3LL 9 ปีที่แล้ว +1

    Hi, I love your tutorials. But Game Maker Studio is not available for Mac, sigh, I wish I can make games on mac :(

  • @ancientmc2552
    @ancientmc2552 7 ปีที่แล้ว

    Just what I was looking for!

  • @SamuelPimpao
    @SamuelPimpao 8 ปีที่แล้ว

    my hearts dissapear when i put the 2º thing we put on the create event and i don't know why

  • @shuujinko
    @shuujinko 7 ปีที่แล้ว +1

    Is there a simple way of doing half-hearts like this? I don't wanna use a whole bunch of ifs lol :)

  • @janedoe2859
    @janedoe2859 6 ปีที่แล้ว

    This works like a charm! Sadly I can't get it to work in a practical sense.
    I've created a health bar for my player, but I can't get my health to reduce, because I'm not sure how to get my health bar to detect that the player has been hit by a enemy. I'm sure it's something I am doing wrong, I'm pretty new to GML. I believe I have to somehow get my health bar to detect the collision event between my player, and my enemy. Any suggestions?

    • @DrJurdenPeterbergsteinlerwitz
      @DrJurdenPeterbergsteinlerwitz 5 ปีที่แล้ว

      Create a controller object (o_controller). Make it persistent.
      In Create Event:
      global.player_hp_max = 100;
      global.player_hp = global.player_hp_max;
      In ANY event that deals damage to the player:
      global.player_hp -= 1;
      instance_destroy();
      This will withdraw 1 hp from the player's health and delete damage dealing object (good for bullets). If you need something that does not self-destroy, then you need to make the player invincible for a short duration so the player does keep taking damage.

  • @sowhat2993
    @sowhat2993 9 ปีที่แล้ว

    hey ben, could you make a tutorial on how to do a line of sight for an top down shooter, like in door kickers (its on steam).

  • @andygates1276
    @andygates1276 9 ปีที่แล้ว

    like the shirt

  • @santiagosossa1345
    @santiagosossa1345 8 ปีที่แล้ว

    This object heart crashes my game maker when I run my game, any idea why???

  • @FioreFire
    @FioreFire 9 ปีที่แล้ว +1

    I sort of skimmed this so forgive me if you addressed it in the video, but might it be worth mentioning how to do half/quarter hearts as well? I'm sure most of the people who want a Zelda-like system would want to do more than have their health measured only in full hearts. It's a little bit of extra work but I think the more complicated uses for loops in this sort of situation might be worth teaching.

    • @devinkrike5968
      @devinkrike5968 9 ปีที่แล้ว

      Firecat1311 I have a script that can take any sprite and display health accordingly. I modified an existing script from yoyo forums and I gotta say, it works like a charm. it can display half hearts, quarter hearts, or any number of pieces you would want.

    • @FioreFire
      @FioreFire 9 ปีที่แล้ว

      Devin Krike I made my own script for it, it works but the code is kinda clunky so I'm interested in seeing a more efficient way of doing it.

    • @devinkrike5968
      @devinkrike5968 9 ปีที่แล้ว +1

      Here is my code, idk if there is a simpler way to write it. ///Draw hearts on screen
      width=sprite_get_width(spr_HP)
      i=0
      pieces=3
      repeat(floor(global.maxHealth/pieces)){
      if (i*pieces

    • @FioreFire
      @FioreFire 9 ปีที่แล้ว

      Devin Krike Coincidentally, fairly soon after posting my comment, I ran into a situation where I'd need to code some hearts again. Here's roughly what I came up with, in a template format: pastebin.com/WAszTPS3
      It's a great deal less clunky than my first attempt, that's for sure. It doesn't account for drawing icons on a second row though. The background heart containers are also handled in a separate bit of code due to the slightly unorthodox way I chose to do them.

    • @devinkrike5968
      @devinkrike5968 9 ปีที่แล้ว

      Firecat1311 Your code looks easier to understand then mine, but still, I think if you can accomplish several tasks in 1 loop its better then splitting them into several loops.

  •  9 ปีที่แล้ว +2

    What about 3D Basics tutorial? BTW. Love your vids.

    • @Preytorcam
      @Preytorcam 9 ปีที่แล้ว

      Tomáš Janoušek Dude that sounds cool. 3d would be hard in GM though

    •  9 ปีที่แล้ว

      There is some way to make it easier using d3d_start() and etc., but I can't figure out how to use it :(

    • @iamsleepy
      @iamsleepy 8 ปีที่แล้ว

      Honestly, if you want to do 3D stuff, just grab Unity.

  • @spritedungeon6648
    @spritedungeon6648 8 ปีที่แล้ว

    Thanks man that was so useful

  • @raigekitrashpost8173
    @raigekitrashpost8173 8 ปีที่แล้ว

    is it possible to add a second row of hearts just like in zelda / metroid?

  • @ancientmc2552
    @ancientmc2552 7 ปีที่แล้ว +2

    Make a 'Making Pokemon Game' Series

  • @TripleZmediA
    @TripleZmediA 8 ปีที่แล้ว

    How would i add an animation to the heart when one disappears?

  • @medamiinlechlech7031
    @medamiinlechlech7031 6 ปีที่แล้ว

    Hi Well tuto
    what about animate the destruction of the heart ?!
    can u only post the code here !
    thanks u !

  • @andygates1276
    @andygates1276 9 ปีที่แล้ว

    how do i do more than one row?

  • @tysonchambers7867
    @tysonchambers7867 8 ปีที่แล้ว

    Thanks Bro!

  • @SirVoidest
    @SirVoidest 9 ปีที่แล้ว +1

    Is there any way you can subtract the health when it gets hit by an enemy?

    • @uglitor
      @uglitor 8 ปีที่แล้ว

      Yes.

  • @darhtchewie
    @darhtchewie 9 ปีที่แล้ว

    Ben, do you think this would work with tour platformer code?

    • @darhtchewie
      @darhtchewie 9 ปีที่แล้ว

      +Dude Crafted He really should, check Shaun Spalding's tutorials he made tutorials of how to make power ups, AI enemies and other stuff.

  • @diagnosedpsychopath5200
    @diagnosedpsychopath5200 9 ปีที่แล้ว +1

    I see that you are a play tester for Rivals of Aether. What is your opinion on it? (If I'm right.)

    • @uheartbeast
      @uheartbeast  9 ปีที่แล้ว

      diagnosed psychopath I love Rivals of Aether! Of course it is still in alpha I think but I will be buying the game when it comes out.

  • @randyro28
    @randyro28 9 ปีที่แล้ว

    Hey Ben, what programming language does GMS use? C++?

    • @cassette7347
      @cassette7347 6 ปีที่แล้ว

      Randy Rodríguez GML.
      (It stands for Game Maker Language.)

  • @KalleJillheden
    @KalleJillheden 9 ปีที่แล้ว

    Since it's the main player you're making the healthbar for why not use the variable 'health' instead of a local variable namned 'hp'?

    • @LostTalent
      @LostTalent 9 ปีที่แล้ว

      ***** You can use either, I don't believe there's a benefit to either. Just down to preference really :)

    • @KalleJillheden
      @KalleJillheden 9 ปีที่แล้ว

      GameMaker Tutorials If you're not doing something like 'globalvar hp' then the built in 'health' variable is better right?

    • @LostTalent
      @LostTalent 9 ปีที่แล้ว

      There's no downside to using either really. they're both variables, the only difference is that health is red! :P. and using a global for health wouldn't be a good idea since it won't be relative to one instance, every object would lose hp and die xD

    • @KalleJillheden
      @KalleJillheden 9 ปีที่แล้ว

      GameMaker Tutorials Well 'health' highlights as you mentioned, and since the application of it will only have one main healthbar it may even be an globalvar? 'health' > 'hp'

    • @LostTalent
      @LostTalent 9 ปีที่แล้ว

      Health is red simply because the fine people who made Game Maker realise it's a common variable people are going to have.
      On your object that you want to have health, in the create event it's going to be like:
      health = 10; or hp = 10;
      there is no difference, because no matter which variable you use, to take away health in the step event it's going to be either health -= 1; or hp -= 1;
      neither act differently and will be 'global' across all instances of that object, in the sense that they will all have a health total but, their health/hp will be different depending on the amount they have been attacked.

  • @lucascordeiro9118
    @lucascordeiro9118 9 ปีที่แล้ว

    Why are you using triple '/' insead of only two?

    • @yoo667
      @yoo667 9 ปีที่แล้ว

      ***** Because instead of making a note it names the whole section of code. :]

    • @uheartbeast
      @uheartbeast  9 ปีที่แล้ว

      ***** Great question! If placed at the top of an "execute a script" action it uses that as the description for the action :) It is quite useful.

  • @adrianeykelkamp9440
    @adrianeykelkamp9440 9 ปีที่แล้ว

    So close, I didn't know what the alpha's values needed was so I just defaulted 0.

  • @emilangeles9209
    @emilangeles9209 8 ปีที่แล้ว

    hi, how can i make a game over here?

    • @Fishermhm
      @Fishermhm 8 ปีที่แล้ว +1

      Sweat and tears. (No blood, thats bad.)

  • @joshbello6097
    @joshbello6097 9 ปีที่แล้ว

    Awwwwwwwwwwwwwsssssssssssssssoooooooooooooommmmmmmmmmmmmmmèeeèeeeeeeeeeeeeeee

  • @eyesinthesky4731
    @eyesinthesky4731 9 ปีที่แล้ว

    You like never show the ending of the project.
    Also, consider putting the code in the description. :b
    Thank you kindly, lol.

    • @drslit
      @drslit 9 ปีที่แล้ว +2

      Kick Butt he showed the end product in the beginning, and not to sound rude but its a tutorial not free code , if you want to see it just pause the video

    • @eyesinthesky4731
      @eyesinthesky4731 9 ปีที่แล้ว

      Skylar Running here, I'll type my point.
      It's a tutorial vid. yes.
      Is it necessary to have us drag through the entire thing staring at his perty face? Crap no.
      He can at least have the decency to at least stick it there so we don't gotta drag through the day not knowing if we missed something.
      It's best to have it there KNOWING it works and making him the most reliable source ever.
      Which people would still watch his vids to see where all the code is placed.
      I loooooove games and I wanna create my own ideas and make deep stories, but it's beyond time consuming.
      I just don't have the time to watch him OVER AND OVER AGAIN. Getting to it literally takes hours for simple details.
      This is about my 3rd or fourth time mentioning this.
      He always comments on my comments but he never comments on these sorts.
      I just see it as a form of selfishness. For the views bruh! For the views.
      I like him a lot. I've taken code classes (barely barely made it. Had help from a guy who wants to work for dice. Master coder who could figure any thing out)
      Ive just dropped it totally. All I can hope now is to find someone who has the gift of coding and if he likes my ideas. We could work together.
      Sadly, I live in freaking Texas. Which politics here is completely my cup of tea. Guns, hooraw, but there's like... nothing here, nor is there plenty of tech savvy people.

    • @drslit
      @drslit 9 ปีที่แล้ว +2

      as someone who is a graduated game dev tech and worked for bigger studios , ben is just about the best teacher you are going to find on youtube (shaun aswell) and he has had a good time and has a wonderful following just the way he is , i dont see why he would change his form of tutorial just for one or two people when the majority of people watching are here for him as a teacher just as much as they are here to see his code , its a package deal , if you dont want to sit through the lesson there is 1000s of code examples on the gmc forums ~ sincerely his 15th subscriber (long time sub) , and someone who likes the way he teaches just the way it is

    • @eyesinthesky4731
      @eyesinthesky4731 9 ปีที่แล้ว

      Skylar Running​ I was literally one of his very first (stone age sub, ask him, lol).
      Doesn't mean he can't place code there.
      I literally don't see a reason of why not.
      So your defense of no improvement is baffling and kills other who actually have a learning disability.
      That's why I'm good at art. So I gotta get it to work, haha.
      I do look up code, but none of it is actually something I'm looking for. They're pretty much the simple stuff.
      P.S. What games have you worked on?

    • @drslit
      @drslit 9 ปีที่แล้ว

      i said nothing about disability so i am not quite sure why you brought that up , all im saying is that i dont know why your watching a tutorial if your just looking for the code. and most recently contract work for black flag (it was my internship for college ) , also gmc.yoyogames.com/index.php?showtopic=574692 , first link when i googled it

  • @fufutg9543
    @fufutg9543 8 ปีที่แล้ว

    is there a way I could do quarter and half hearts?

    • @fufutg9543
      @fufutg9543 8 ปีที่แล้ว +2

      ***** HELPFUL

    • @ElectricDonkeyGML
      @ElectricDonkeyGML 8 ปีที่แล้ว

      +Fufu The Gargoyle Try making another image inside the heart sprite with half and quarter of a heart and then if the make each quarter = 1 hp so then when you draw each heart check if the hp is divisible by 4 and turn the remainders into the image_index for the half and quarter images (sorry if you didn't get all that :P)

    • @panta_rhei.26
      @panta_rhei.26 8 ปีที่แล้ว +1

      +GameSmashDash That's how I learned Calculus Theorem. By messing around with numbers until BAM CALCULUS

    • @panta_rhei.26
      @panta_rhei.26 8 ปีที่แล้ว

      +GameSmashDash Yes, but just "messing around with intent" isn't learning. You need some sort of reference.

  • @soba9929
    @soba9929 7 ปีที่แล้ว

    i,m lost...

  • @shutmc1730
    @shutmc1730 9 ปีที่แล้ว +5

    I get two for the price of one? The price of one is free. That's like getting two for the price of two, since it's free either way. :P

    • @uheartbeast
      @uheartbeast  9 ปีที่แล้ว +2

      Shutmc1 ;)

    • @hamza62240
      @hamza62240 8 ปีที่แล้ว +1

      +HeartBeast
      Hey, dude, I really need some help here.
      How would I, uh, have 'half hearts'? So every heart has a:
      Full
      Half
      Empty
      state. If the player gets hit by an enemy once, the state becomes Half, and if the player gets hit again, it becomes empty. Kind of like in The Binding of Isaac.

  • @Etienne_H
    @Etienne_H 9 ปีที่แล้ว

    for(;;);
    enjoy.

  • @AdityaKumar-xu6ug
    @AdityaKumar-xu6ug 9 ปีที่แล้ว

    Try scratch.mit.edu it's pretty cool

  • @joshbello6097
    @joshbello6097 9 ปีที่แล้ว

    First comment

  • @GilBenjamin
    @GilBenjamin 7 ปีที่แล้ว

    how i do it with enemy ?

    • @Ttilhbw
      @Ttilhbw 6 ปีที่แล้ว

      just make that when a player collides the enemy obj_stats.hp--;
      and use a knockback event that the health doesnt go fully down