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
Please bring this series back!
Yes!
Yes is series is so cool
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!
Same tbh.
Hey, are you ever going to do this again
I wish he does
I'm gonna say no
Yo! This leaked theme for smm2 is really neat!
I really like the pace and structure of your videos. And the audio sounds great!
Thanks so much! I’m really glad you like the videos and can’t wait to keep making more :)
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.
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.
like a lot of other comments have said, im looking forward to the next episode, but dont feel rushed! take ur time :)
3:16 ...
1. The last check should just be "else"
2. USE SWITCH-CASE
Yooo! This is so cool!
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
Bring this series back!
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.
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!
Can u tell me what enum means cause I use it blindly
@@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.
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.
@@meziu2103 It's true, honestly everyone looks back at their old code and barfs.
I love this series! Could you figure out pipes and sub areas
imagine you remaking the entire mario maker 2 in unity.
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 :)
Another great video!
P.D. You are so great, its incredible, I can´t do that miself, you got a new subscriber!!!
Makes one think the process involved in making the classic SMB back in 1985
i get it but if you mean smb was made in unity, they didnt buddy, unity didnt even exist in 1985
Thanks for this!
You are underrated, you deserve more subs! so I subbed
Thanks :)
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 !
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.
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
you
no fancy big coin collect animation or coin sparkles?
Nice
You can try and recreate pow blocks next, just a fun idea
And this is the last we heard of this series...
3:18 this would be more efficient with a switch statement, i think
the compiler would optimize it
Wouldn't having one function that takes a coin count arg be even better
God I wish I found this sooner
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
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.
Its not a tuto
It's been 2 and a half years since this episode. When will the third one come out?
Yahoo!
also add the angry sun and happy moon
please, more, I want to see how to do the power up things
When you said series, seri said hi...
Nobody but you heard that, even the auto-generated captions didn't hear that...
will you make an entire mario maker game where people can make and play these
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. ;)
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.
Programming! I dont understand anything going on here. I love it
I mean your no idea wrong
please bring this back
I think of Recreating a Goomba and the Spikes.
yes
I gonna recreate smm2 to my nn3ds... one day
4 methods for adding 2 ints together?
Why not just use a parameter? ;P
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)
Yeah, I was wondering that as well.
That’s definitely a much better way of doing it; thanks for the advice! I’ll add that change to the GitHub repository.
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.
How do you make and import the pixel art?
U should make a level creation ui
Cool video but I'm a bit triggered you used enums for the different coin types instead of polymorphism
That's sad that this fan game is not continued
Can we get some more please?
Do an Episode 3
Why not make all the AddCoin functions one function with an argument?
I think he wont do the third video
3:03
Why didn't you just add an argument to the existing function which would contain the amount of coins to be added?
All Mario themes are just the same engine but repainted (except for smbu)
part 3
Hello :)
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...
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");
}
}
}
That's not how the coin blocks with multiple coins in them work.
cool
first ı dont understand, next okey. thanks.
I hope that Nintendo never see this :D
So... uh... whatever happened to this series?
696969696969696969
don't work