Тёмный

5 Minute DOODLE JUMP Unity Tutorial 

BMo
Подписаться 29 тыс.
Просмотров 22 тыс.
50% 1

Doodle Jump was one of the first mobile games to reach wide spread popularity, and was a massive success. Learn how to make the basics in this 5 minute unity tutorial.
Pro Tip: If its too fast, play the video on .5 speed and pause often!
This was tough to edit down, sorry 😅
✨Want to support the channel?
Buy me a coffee ☕: ko-fi.com/bmoli
➤LIKE the video if you enjoyed, it really helps the channel!
➤SUBSCRIBE to the channel, you'll make me happy
➤MORE 5 Minute Tutorials: • 5 Minute Games
➤Join our DISCORD SERVER: / discord
We have channels to help you with your problems!
0:00 Background Image
I googled around for the Doodle Jump assets, and was able to find the Background, Player sprite, and platform sprite. USE ANY ART ASSETS YOU WANT!
With the background we simply just add it to the scene, reset its transform, and then attach it as a child gameObject to the Main Camera. This makes it so the background will always follow the camera.
0:017 Player Setup
We drag in a player sprite, and then we attach a BoxCollider2D. Using the edit collider button, we can then drag in the edges of the BoxCollider so that we're only detecting collisions around the base of the sprite. This may vary depending on the player sprite you're using. We don't want the collider to be too small or you may have errors when calculating collisions, so leave a bit of a buffer.
We then attach a Rigidbody2D, and set the Collision Detection mode from "Discrete" to "Continuous". This provides us with a cleaner detection algorithm at the expensive of processing power, but in this case where precision is important it's worth it.
We then want to add a Constraint to freeze the rotation in the Z axis, so that our sprite won't rotate on its own and mess up the movement code.
Finally we create a new C# script, PlayerController and add it to the player GameObject.
1:05 Platform Setup
We drag in a platform sprite, and for the platform we want the player to be able to pass through the bottom of a platform, but detect collisions from the top. To do this we need to add an EdgeCollider2D component, and then we also add a Platform Effector 2D component.
On our EdgeCollider2D we want to enable "Used By Effector", and on our Platform Effector 2D we want to make sure "Use One Way" is checked, it should be by default.
With that, you should see a 180 degree arc coming from the top of the platform, which means it will only detect collisions within that arc.
Again, we add a new C# script Platform and add it to the platform gameobject.
1:34 Create Camera Script
We create and add a new C# script CameraFollow to the Main Camera
1:40 Create GameManager
We create an empty GameObject, call it GameManager, and then create a new C# script called GameManager to this GameObject.
1:50 Platform Prefab
We then drag our platform GameObject from ther Hierarchy into our Assets folder, which will create a Platform Prefab.
1:59 PlayerController Script
For the Player movement we basically only want to be able to move left and right, and we want to tweak how fast we can move based on a MoveSpeed variable.
To handle movement we need a reference to our Rigidbody2D.
In Update we want to detect any inputs from the player, so we store our "Horizontal" input axis into a private variable.
In FixedUpdate, we want to handle physics calculations within our Rigidbody2D, so using our captured input from Update, we then update our current velocity.
2:52 Platform Script
For our platform script, we want to store a JumpForce float variable we can tweak, and then basically OnCollisionEnter2D we want our player to be launched up by the jump force, but only when our Player is landing from the top, otherwise this could cause issues if we perform the boost when the player is passing through the bottom of the platform.
3:36 CameraFollow Script
We store a Transform target variable to follow. And then in our LateUpdate method, we basically create a new Vector3 using the camera's X and Z axis, but the Player's Y axis, and assign this new vector3 to the camera's position.
We only want to do this when the player has gone above our Camera's vision, so that we pan the camera up to follow it.
4:14 GameManager Script
On Start we want to procedurally generate a random level. We store how many platforms we want to make, and then in a For loop we create X amount of platforms, always increasing the Y value by a small amount (.5 to 2) and choosing a random X value.
With my settings, when I dragged the platform to the edges of the Game Screen, the values were around -5 and 5, so I used that. You may have to use different values there!
We then instantiate the platforms using the newly created position and the Quaternion.identity rotation.
You now more or less have the base Doodle Jump game ready to play with and to build from.
Thanks for watching!
#bmo #unity #tutorial

Опубликовано:

 

29 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 68   
@eileeng2492
@eileeng2492 3 года назад
Useful and clear! Thanks BMO, Appreciate your style.
@TheEarlPH
@TheEarlPH 3 года назад
Ur videos are great, Easy to understand and u are clear in saying the instructions and etc. Please don't stop making tutorials ♥️
@BMoDev
@BMoDev 3 года назад
I won't let you down
@goosewoosey2920
@goosewoosey2920 7 месяцев назад
your videos are great and i appreciate how clear your instructions are. i do wish you would explain why you do certain things rather than solely stating them. but do keep making more, your content is super helpful
@iliachakarov7285
@iliachakarov7285 10 месяцев назад
AWESOME!!! TY man!! Long may u reign!!!
@IceCream-sb7lc
@IceCream-sb7lc 3 года назад
Much 🔥 , very wow tutorial! You know what I'm going to ask for next... FLAPPY BIRD AND TEMPLE RUN. 🙂
@BMoDev
@BMoDev 3 года назад
Hahah I kinda touched on the endless runner genre already... eventually I'll do it when I run through the backlog
@renojakerman945
@renojakerman945 2 года назад
Thx, unity is now using 10 gb of the memory of my pc👌
@BMoDev
@BMoDev 2 года назад
gotta get those numbers up
@pedromorales753
@pedromorales753 2 года назад
Thanks bro, u save my life
@BMoDev
@BMoDev 2 года назад
flappy bird saved all our lives
@argheriedaniel1796
@argheriedaniel1796 3 года назад
Hello , very nice tutorial ! Can you give me some help because I want to add to my game the "open level edges". Like when ur character goes full right it will appear from the left side. Thanks !
@zeerofn1473
@zeerofn1473 3 года назад
Thanks Alot
@BMoDev
@BMoDev 3 года назад
you got it bruh
@antibanplay
@antibanplay 2 года назад
I can't find a normal script for dead zone invisible platform after fallind
@gunshotcharlie9
@gunshotcharlie9 2 года назад
I’m getting an error in game manager script saying ‘Quaternion’ does not contain a definition for ‘identity’ plz help
@amandacollins7392
@amandacollins7392 3 года назад
BMO bouncy man can doodle jump meh anytime 😏
@randomideationstudios2818
@randomideationstudios2818 2 года назад
How do I Spawn the platform infinitely?????
@antibanplay
@antibanplay 2 года назад
What about dead zone?
@Veemoveemo1231
@Veemoveemo1231 2 месяца назад
1:59 cool but can you show me how to do this by using mouse/finger? because im making a mobile game
@aixjelesx
@aixjelesx 2 года назад
Simple, Fast, Everything beginners need
@BMoDev
@BMoDev 2 года назад
@revendisio
@revendisio Год назад
Wrong. A beginner needs explanation of what you actually do. Why you choose this and that. Why you changed this option and so on. This "Tutorial" is absolutely NOT beginner friendly. It's an instruction that you follow to have the game in the end, but it's nothing you learn from. Sadly this kind of "tutorials" make beginners copy the code one by one and let them think they programed something.
@arcade_ghost15
@arcade_ghost15 3 месяца назад
​@@revendisioIt depends on the person. I'm a beginner and I much prefer fast tutorials like this because the example helps with my understanding. Obviously you won't get an in depth explanation from these but they could work as an introduction or reinforcement on whatever concepts i'm currently studying (to see it in action). It does depend on your learning style whether that works for you or not but for me (and a lot of other people in the comments), I learn a lot from videos like these.
@max109y
@max109y 3 года назад
is there any way of you making a tutorial on a shop system with skin selection threw multiple scenes?
@BMoDev
@BMoDev 3 года назад
🤔Maybe one day
@logicanbro5020
@logicanbro5020 2 года назад
@@BMoDev I know I am a little bit late, but can you make one like that you can change skin and the background??
@zeerofn1473
@zeerofn1473 3 года назад
@BMo I have another code error for the gamemanager script. Also, i assure you that i have worte it right because i havewatched the vid like 5 times in .25 speed. the error is: Cannot implicitly convert type 'float' to 'int'. An explicit conversion exists (are you missing a cast?) again, the code is: using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameManager : MonoBehaviour { public GameObject platformPrefab; public int platformCount = 300f; void Start() { Vector3 spawnPosition = new Vector3(); for (int i = 0; i < platformCount; i++) { spawnPosition.y += Random.Range(.5f, 2f); spawnPosition.x = Random.Range(-5f, 5f); Instantiate(platformPrefab, spawnPosition, Quaternion.identity); } } }
@k-kayla
@k-kayla 3 года назад
public int platformCount = 300f; Remove the f from 300. You are trying to turn the int to a float there. At 4:29 he does not have the f there either.
@zeerofn1473
@zeerofn1473 3 года назад
@@k-kayla thanks so much. You just saved me
@k-kayla
@k-kayla 3 года назад
@@zeerofn1473 😊👍 Good luck!
@dr.jigarshah4283
@dr.jigarshah4283 Год назад
Because you have written public int platformCount = 300f; remove the f, f means you have a float but you have written public int, so in the int variable floats can't come. and also 300 isn't a float so remove the f
@revendisio
@revendisio Год назад
This is a very beginner unfriendly tutorial. You show what you do, but you don't explain Anything. Not a single word about why you change options and do what you do. People doesn't learn anything this way. I wouldn't even call it a tutorial. It's an instruction. People follow it and get this app in the end, but they don't learn anything about programing of Unity. It's sad, because many beginners follows those kind of instructions, copy the code 1:1 and think they programed something. And on top of that this "tutorial" doesn't even include the whole game. I only includes half of it. Important parts of the game like platform respawn, the deadzone, gameover, restart etc. are completely missing to fit the 5 minute goal. The title of the video should be "5 minute half of Doodle Jump Unity instruction". You can literally see how many ppl have problems in the comments. Problems that could have been avoided entirely by explaining properly.
@petpigistygames2851
@petpigistygames2851 2 года назад
I do actually have a issue I need help with I put in all the code and there are no errors or messages and also put info in all boxes but the camera doesn't follow the character and he doesn't gain momentum from jumping on platforms
@petpigistygames2851
@petpigistygames2851 2 года назад
If this helps it says the LateUpdate on the camera one has 0 referances
@tobitoon3171
@tobitoon3171 11 месяцев назад
I don't get why your platforms are so spreaded? My platforms are just messy because they only spawn in the specified area in the game manager. y = .5f, 2f and x = -5f, 5f.
@zeerofn1473
@zeerofn1473 3 года назад
@BMo I have a code error for the platform script and i was wondering if you could help? the error is that is says: Cannot convert method group 'GetComponent' to non-delegate type 'Rigidbody2D2. Did you intend to invoke the method? THe code is: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Platform : MonoBehaviour { public float jumpForce = 10f; private void OnCollisionEnter2D(Collision2D collision) { if (collision.relativeVelocity.y
@mymother3650
@mymother3650 2 года назад
Rigidbody2D rb = collision.gameObject.GetComponent();
@pebble7500
@pebble7500 Год назад
So what is the answer?
@petpigistygames2851
@petpigistygames2851 2 года назад
I need some help I entered the code for the player movement script exactly as shown but it pops up errors and says that horizontal axis and rb don't exist
@petpigistygames2851
@petpigistygames2851 2 года назад
nvm
@samyaks.h1990
@samyaks.h1990 3 года назад
if you set plantformCount to 300 it would generate 300 platform in total so if i wanted infinite can i set platformCount = Mathf.infinity?
@crosline
@crosline 3 года назад
and it'll crash
@YaTa1234
@YaTa1234 3 года назад
@@crosline so.. how?
@z77876
@z77876 Год назад
just code it so it adds more as the game goes on
@witheringcherrytee4761
@witheringcherrytee4761 Месяц назад
(very late reply) i got it to work by changing the platformCount to a float instead of an int and it made them infinite
@blendersoy
@blendersoy 6 месяцев назад
my camera is not following, i dont know why the script is correct, I had target i dont know
@blendersoy
@blendersoy 6 месяцев назад
por suerte chatgpt me soluciona todo jajajja
@YaTa1234
@YaTa1234 3 года назад
this is more useful than 7 hour video
@revendisio
@revendisio Год назад
Not if you sctually want to learn something.
@DertyDub
@DertyDub 2 года назад
2:00
@tadeasnapackach4496
@tadeasnapackach4496 2 года назад
pleae help what is wrong ? camera follow script using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraFollow : MonoBehaviour { public Transform target; private void LateUpdate() { if (target.position.y > transform.position.y) { Vector3 newPosition = new Vector3(transform.posititon.x, target.position.y, transform.position.z) transform.position = newPosition; } } }
@tadeasnapackach4496
@tadeasnapackach4496 2 года назад
BMo please
@tadeasnapackach4496
@tadeasnapackach4496 2 года назад
4:04
@BMoDev
@BMoDev 2 года назад
Youre missing a ; when you create newPosition
@HarryScanlan
@HarryScanlan Год назад
LIke.. the last 3 seconds is probably one of the most important parts but its SO fast. Drag the Prefab to where exactly??? Like.. 10 more seconds and this video would have been much more useful
@HarryScanlan
@HarryScanlan Год назад
Looks like I couldn't "drag it" there because I had a typo in the script. I didn't realize that was how you set the objects...
@diebrochs16
@diebrochs16 2 года назад
whats wrong? Platforn script 3:22 thx :) using System.Collections; using System.Collections.Generic; using UnityEngine; public class Platform : MonoBehaviour { public float jumpForce = 10f; private void OnCollisionEnter2D(Collision2D collision) { if (collision.relativeVelocity.y
@BMoDev
@BMoDev 2 года назад
Rigidbody2D rb = collision.gameObject.GetComponent(); is atleast one compiler error
@diebrochs16
@diebrochs16 2 года назад
@@BMoDev thx
@trstation3172
@trstation3172 2 года назад
@@BMoDev thxxxxx
@sacarymoviesamu
@sacarymoviesamu 2 года назад
i don't get it. Like all the platforms re mashed up toguether, you did not even talk about how to make your character appear on the other side of the screen. This is just a cheap excuse for a 5 min video bro.
@subwaye
@subwaye 3 года назад
Pin this comment i dare you
@piyushrahi478
@piyushrahi478 2 года назад
You failed, you failed to add a death in the script and even the damn menu and reload the game in the script. Also Brackey did this 4 years ago
@BMoDev
@BMoDev 2 года назад
true, I suck
Далее
5 Minute 2D Lighting in Unity Tutorial 2021
5:09
Просмотров 37 тыс.
Create a DOODLE JUMP Clone in Unity Tutorial!! [1/2]
29:00
I Made A Platformer Game But You're The Enemy
6:12
Просмотров 410 тыс.
Making the World's Hardest Mobile Game
11:51
Просмотров 3,3 млн