Remaking COINS and COIN BLOCKS in Unity - Mario Maker Deconstructed #2

Поделиться
HTML-код
  • Опубликовано: 6 сен 2019
  • Welcome to PocketMars (now PolyMars), a channel focused on game development in Unity!
    In this video, I recreate two level mechanics that are found in just about every Mario game- coins and coin blocks. This is the second episode of Mario Maker Deconstructed, a series where I recreate various course elements from Mario Maker in Unity.
    Project repository:
    github.com/PolyMarsDev/Mario-...
    Follow me on Twitter for more frequent updates on my projects!
    / polymarsyt

Комментарии • 92

  • @lawrenceblackbourne5966
    @lawrenceblackbourne5966 3 года назад +14

    Please bring this series back!

  • @coolstylebro2814
    @coolstylebro2814 3 года назад +42

    Try to remake Goombas next! Maybe even Big Goombas that split in two small Goombas when jumped on, Para-Goombas that jump and, when jumped on, lose their wings and turn into Goombas, parachuting Goombas that float down and lose their parachute when jumped on or when it lands on the ground and a Goomba stack that loses Goombas when jumped on. I wanna see it!
    Also, I am a huge Mario fan and also learning Unity and, I gotta say, this series is great!

  • @Doubleshotgun
    @Doubleshotgun 3 года назад +66

    Hey, are you ever going to do this again

  • @PresumedGecko20
    @PresumedGecko20 3 года назад +5

    Yo! This leaked theme for smm2 is really neat!

  • @achetillergames6911
    @achetillergames6911 4 года назад +2

    I really like the pace and structure of your videos. And the audio sounds great!

    • @PolyMars
      @PolyMars  4 года назад +1

      Thanks so much! I’m really glad you like the videos and can’t wait to keep making more :)

  • @jmvr
    @jmvr 3 года назад +12

    There's a few issues I have with this that are minor and won't affect any other opinion on the potential full recreation of SMM2:
    The coin shine animation isn't actually a gradient, but a sudden change that loops. Also, if the animation is tied to each object instead of globally, it might desync when loading and unloading the coins offscreen.
    It looks like the jump follows a realistic curve. In SMM, it doesn't (for my knowledge, I could be wrong). I believe it takes a shorter time reaching the ground from the highest point in the jump, than it does reaching that point from the ground. In the recreation and in real life, both those times are equal.
    The 10-coin coin block gives you equal or less coins based off when you hit the block, as in if you don't hit it fast enough, you won't get all 10 coins. From what I've seen from the code, it looks as though you'll always get 10 coins no matter how long it takes.
    These are all little things, and doesn't affect the recreation at all, but I just wanted to give my 2 cents. Please do tell me if I'm wrong about any of these.

    • @kodicraft
      @kodicraft 3 года назад +1

      More specifically, the 10 coins block gives you 10 seconds to collect all coins, after the 10 seconds, if not all coins were taken, it changes into a normal coin block.

  • @Mythicalwaters
    @Mythicalwaters 3 года назад +2

    like a lot of other comments have said, im looking forward to the next episode, but dont feel rushed! take ur time :)

  • @otesunki
    @otesunki 3 года назад +3

    3:16 ...
    1. The last check should just be "else"
    2. USE SWITCH-CASE

  • @McMistrzYT
    @McMistrzYT 3 года назад +6

    Yooo! This is so cool!

  • @strasznieciekawe
    @strasznieciekawe Год назад

    Wait, let's say i have 20 boxes with coins. Do i have to remake the ingame "jump" animation for every single one of them?
    When i'm done with animation and i'm adding the box as prefab, only this first one works and the rest is acting weird

  • @theofficialamt6626
    @theofficialamt6626 3 месяца назад

    Bring this series back!

  • @mikaxms
    @mikaxms 4 года назад +13

    3:05 I would convert the enum to an integer and then have one function that has an integer parameter which is added to the coinCount. This makes it easier when you need to add more coin types or when you need to change something about the add coin function. I would also rename "coinCount" to "playerCoins"; coinCount is pretty vague.

    • @PolyMars
      @PolyMars  4 года назад +4

      Thanks for the tips! I agree that having separate functions for each coin type is pretty clunky and really like your method as an alternative. I also agree that “playerCoins” is easier to interpret than “coinCount”. I’ll add these changes to the GitHub repository!

    • @KainDestinedAscension
      @KainDestinedAscension 3 года назад

      Can u tell me what enum means cause I use it blindly

    • @mikaxms
      @mikaxms 3 года назад

      @@KainDestinedAscension You can convert the enum values to integers using a switch statement. So, if "CoinType.Thirty" output "30", etc. Though, getting rid of the enum all together is easier, than this converting mess.

    • @meziu2103
      @meziu2103 3 года назад

      I watched this video just now and got triggered when saw him using multiple functions. Thank god someone helped this poor soul at the time of the posting of the video. I’m just kidding, I did such mistakes too, like writing a GIGANTIC switch statement instead of iterating through an array.

    • @michaelepica3564
      @michaelepica3564 3 года назад +1

      @@meziu2103 It's true, honestly everyone looks back at their old code and barfs.

  • @mak7066
    @mak7066 4 года назад +3

    I love this series! Could you figure out pipes and sub areas

  • @bruhawman8922
    @bruhawman8922 3 года назад +5

    imagine you remaking the entire mario maker 2 in unity.

  • @SeithonJetter
    @SeithonJetter 4 года назад +3

    Very informative :) I agree with Mika's comment and was going to say the same, anytime you find yourself duplicating a block of code and changing a single variable, try and see if you can instead just inject the variable into the original block in some way :)

  • @tyleranders9972
    @tyleranders9972 4 года назад

    Another great video!

  • @smbroos8316
    @smbroos8316 3 года назад

    P.D. You are so great, its incredible, I can´t do that miself, you got a new subscriber!!!

  • @vikrantsingh6580
    @vikrantsingh6580 3 года назад +1

    Makes one think the process involved in making the classic SMB back in 1985

    • @win_ini
      @win_ini 3 года назад

      i get it but if you mean smb was made in unity, they didnt buddy, unity didnt even exist in 1985

  • @thegametent
    @thegametent 4 года назад +2

    Thanks for this!

  • @Dennis_xm
    @Dennis_xm 4 года назад +2

    You are underrated, you deserve more subs! so I subbed

  • @777omen
    @777omen 3 года назад +1

    This coin system recreation can be used for purples coins challenges ! Just make coins purples with a star on it and add a counter for purples coins depending how many they are !

  • @CoolModderJaydonX
    @CoolModderJaydonX 10 месяцев назад

    I think for the "AddCoins" functions, I would've made it so that based on which coin you get, it would pass in a parameter of the amount of coins, kind of like "AddCoins(int coinNumber)" instead of coding every one of them separately.

  • @PyroPickleBB
    @PyroPickleBB 4 года назад +5

    Do you think you could do a tutorial on how to re-create the level editor system? The ability for players to place their own blocks in game seems difficult

  • @DogeisCut
    @DogeisCut 3 года назад +1

    no fancy big coin collect animation or coin sparkles?

  •  2 года назад

    Nice

  • @basicallytutorials2107
    @basicallytutorials2107 3 года назад

    You can try and recreate pow blocks next, just a fun idea

  • @TheUnluckiestPencil
    @TheUnluckiestPencil 3 года назад

    And this is the last we heard of this series...

  • @Hazelpy
    @Hazelpy 3 года назад +2

    3:18 this would be more efficient with a switch statement, i think

    • @doctard2990
      @doctard2990 3 года назад +1

      the compiler would optimize it

    • @RealistikDash
      @RealistikDash 3 года назад

      Wouldn't having one function that takes a coin count arg be even better

  • @TinyDeskEngineer
    @TinyDeskEngineer 2 года назад

    God I wish I found this sooner

  • @dr.unventor
    @dr.unventor 4 года назад

    u should try adding enemies and ur own feature so u can make a unique level imposable in the real game. Use the on/off swiches too

  • @nickmalialis6
    @nickmalialis6 Год назад

    Hello.
    Great tutorial. Are you able to recreate the Underwater levels. Making a swimming mechanic is something that would be great to have. Thank you.

  • @SsvbxxYT
    @SsvbxxYT 2 года назад

    It's been 2 and a half years since this episode. When will the third one come out?

  • @blaitehere
    @blaitehere 3 года назад

    Yahoo!

  • @dr.unventor
    @dr.unventor 4 года назад +1

    also add the angry sun and happy moon

  • @smbroos8316
    @smbroos8316 3 года назад

    please, more, I want to see how to do the power up things

  • @thepinkchicken247
    @thepinkchicken247 3 года назад +2

    When you said series, seri said hi...

    • @DJSlimeball
      @DJSlimeball 3 года назад

      Nobody but you heard that, even the auto-generated captions didn't hear that...

  • @colinoisrandom814
    @colinoisrandom814 3 года назад

    will you make an entire mario maker game where people can make and play these

  • @gustavosalmeron2013
    @gustavosalmeron2013 2 года назад

    hey! You can do the same with the box's collider (instead of using its transform, get its collider bounds and only check if the player was below)
    That would change the if condition to only 1 condition, I suppose. ;)

    • @gustavosalmeron2013
      @gustavosalmeron2013 2 года назад

      It doesn't seem like it... The player's bound actually gets above the box's collider when the collision is triggered. Well, it was interesting nonetheless.

  • @copper803
    @copper803 3 года назад

    Programming! I dont understand anything going on here. I love it

    • @salad6975
      @salad6975 2 года назад

      I mean your no idea wrong

  • @12newangels
    @12newangels 3 года назад

    please bring this back

  • @smth35
    @smth35 3 года назад +1

    I think of Recreating a Goomba and the Spikes.

  • @why_awesome
    @why_awesome 3 года назад

    yes

  • @tzoomislayer
    @tzoomislayer 2 года назад

    I gonna recreate smm2 to my nn3ds... one day

  • @lonelyPorterCH
    @lonelyPorterCH 3 года назад +1

    4 methods for adding 2 ints together?
    Why not just use a parameter? ;P

  • @nkusters
    @nkusters 4 года назад +2

    Why have different functions for the coins? You can just pass the amount of coins to add, then add a switch/if to see which sound to play (or pass that along as well)

    • @mikaxms
      @mikaxms 4 года назад

      Yeah, I was wondering that as well.

    • @PolyMars
      @PolyMars  4 года назад +1

      That’s definitely a much better way of doing it; thanks for the advice! I’ll add that change to the GitHub repository.

    • @nkusters
      @nkusters 4 года назад +1

      PocketMars; I haven’t been around a PC yet, might check it out for fun and submit a pull request if I find something else.

  • @3th4nP31ff3r
    @3th4nP31ff3r 4 года назад

    How do you make and import the pixel art?

  • @ryancaling1711
    @ryancaling1711 3 года назад

    U should make a level creation ui

  • @m.z.2466
    @m.z.2466 3 года назад

    Cool video but I'm a bit triggered you used enums for the different coin types instead of polymorphism

  • @GrubyOut
    @GrubyOut 3 года назад

    That's sad that this fan game is not continued

  • @lextatertotsfromhell7673
    @lextatertotsfromhell7673 3 года назад

    Can we get some more please?

  • @FairButNotReally
    @FairButNotReally 3 года назад

    Do an Episode 3

  • @aidenlilley1319
    @aidenlilley1319 3 года назад

    Why not make all the AddCoin functions one function with an argument?

  • @user-xe3ng6sj9o
    @user-xe3ng6sj9o 3 года назад

    I think he wont do the third video

  • @kr0tyara
    @kr0tyara 3 года назад

    3:03
    Why didn't you just add an argument to the existing function which would contain the amount of coins to be added?

  • @vickygardiner3375
    @vickygardiner3375 3 года назад

    All Mario themes are just the same engine but repainted (except for smbu)

  • @luandesousasantos366
    @luandesousasantos366 4 года назад

    part 3

  • @Jellyjam14blas
    @Jellyjam14blas 3 года назад

    Hello :)

  • @rorymax
    @rorymax 3 года назад

    huh why did you make seperate methods for adding coin amounts? that didnt make much sense. it wouldve made more sense to just have one method and pass in a param lol...

  • @nkusters
    @nkusters 4 года назад +1

    Maybe I'll do a video on refactoring and use this code as an example, but here are some things you can do.
    I've submitted a pull request for this one here: github.com/PocketMars/Mario-Maker-Deconstructed/pull/2
    In the Player.cs script:
    I don't like having 'magic' strings and numbers, so I always try to put them in constants:
    const string HorizontalAxis = "Horizontal";
    ///
    /// List of animation trigger names
    ///
    private class AnimationTriggers
    {
    internal const string Idle = "idle";
    internal const string Jump = "jump";
    internal const string Run = "run";
    }
    Then, if you look at the FixedUpdate function, you can trim it down, to just this:
    void FixedUpdate()
    {
    moveInput = Input.GetAxis(HorizontalAxis);
    rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
    bool moving = moveInput != 0;
    string
    resetTrigger = moving ? AnimationTriggers.Idle : AnimationTriggers.Run,
    setTrigger = moving ? AnimationTriggers.Run : AnimationTriggers.Idle;
    if(moving) transform.eulerAngles = new Vector3(0, moveInput > 0 ? 0 : 180, 0);
    anim.ResetTrigger(resetTrigger);
    anim.ResetTrigger(isGrounded ? AnimationTriggers.Jump : setTrigger);
    anim.SetTrigger(isGrounded ? setTrigger : AnimationTriggers.Jump);
    }
    It used to be this:
    void FixedUpdate () {
    moveInput = Input.GetAxis ("Horizontal");
    rb.velocity = new Vector2 (moveInput * speed, rb.velocity.y);
    if (moveInput > 0) {
    transform.eulerAngles = new Vector3 (0, 0, 0);
    if (isGrounded) {
    anim.ResetTrigger ("idle");
    anim.ResetTrigger ("jump");
    anim.SetTrigger ("run");
    } else if (!isGrounded) {
    anim.ResetTrigger ("run");
    anim.ResetTrigger ("idle");
    anim.SetTrigger ("jump");
    }
    } else if (moveInput < 0) {
    transform.eulerAngles = new Vector3 (0, 180, 0);
    if (isGrounded) {
    anim.ResetTrigger ("idle");
    anim.ResetTrigger ("jump");
    anim.SetTrigger ("run");
    } else if (!isGrounded) {
    anim.ResetTrigger ("run");
    anim.ResetTrigger ("idle");
    anim.SetTrigger ("jump");
    }
    } else if (moveInput == 0) {
    if (isGrounded) {
    anim.ResetTrigger ("run");
    anim.ResetTrigger ("jump");
    anim.SetTrigger ("idle");
    } else if (!isGrounded) {
    anim.ResetTrigger ("run");
    anim.ResetTrigger ("idle");
    anim.SetTrigger ("jump");
    }
    }
    }

  • @Matt_From_2006_Game_Wii_Sports
    @Matt_From_2006_Game_Wii_Sports 3 года назад +4

    That's not how the coin blocks with multiple coins in them work.

  • @ayhanayhan2751
    @ayhanayhan2751 3 года назад +1

    first ı dont understand, next okey. thanks.

  • @lggproduction
    @lggproduction 3 года назад

    I hope that Nintendo never see this :D

  • @NStripleseven
    @NStripleseven 3 года назад

    So... uh... whatever happened to this series?

  • @Sovietube
    @Sovietube 3 года назад

    696969696969696969

  • @Gregini1_
    @Gregini1_ 3 года назад

    don't work