5 Minute ENDLESS RUNNER Game UNITY Tutorial

In this Unity Tutorial, learn how to make an Endless Runner or Infinite Runner game in 5 minutes! Or... at least the foundation for one.
There are many different approaches when it comes to the Endless Runner genre. Sometimes the player is stuck on a track and can only move in one axis, sometimes the player can freely move wherever they want while the camera scrolls. It depends on how you want to design it!
For this example, the camera will be stationary, the backgrounds will scroll across the camera and reset, and the player will only be able to move vertically within the confines of the camera to avoid incoming obstacles.
✨Want to support the channel?
Buy me a coffee ☕: ko-fi.com/bmoli
➤LIKE the video if you enjoyed, it really helps the channel!
➤Join our DISCORD SERVER: / discord
We have channels to help you with your problems!
0:00 Repeating Background
The first thing we need to do is setup our repeatable scrolling background. I used an outer space theme as it's just an easy way to accomplish this, but there are plenty of resources out there on how to make your own "seamless pattern" images.
Here is the 1.5 minute Photoshop tutorial I followed to make my space background: • How to Photoshop Space...
My image was 2000x1000 pixels, which in Unity world space units is about 20 x, 10 y in our default Main Camera. This means that with my first image set to the origin position (0,0,0), a second image could be placed at (20,0,0) to be perfectly lined up.
Once you have a seamless pattern created and you've tested it by aligning 2 of them, we then want to add a BoxCollider2D, a Rigidbody2D, as well as a script to handle the scrolling & resetting position logic.
The BoxCollider2D will be used to store the width of the image, as adding a Collider2D defaults to auto-sizing the image (which is desireable in this case).
The Rigidbody2D will be used to move the background images across the screen.
The BackgroundScroller script will make all of that happen.
2:50 Player Controls
For my example, I'm restricting the player to only move up and down vertically. I used a 64x64 pixel square as the Player, set its sprite color to Cyan, added a Rigidbody2D component, as well as a new C# script PlayerController.
In PlayerController we get the Vertical Input axis value in our update, and setting our Rigidbody2D velocity we multiply the input axis by our movespeed.
Here are some other tutorials where I've covered player movement in more detail:
2D SideScroller Movement Tutorial: • 2D Side Scroller MOVEM...
2D Top Down Movement Tutorial: • 2D Top Down Movement U...
6 Minute Pong Tutorial: • Making PONG in 6 Minut...
3:45 Bounds Detection
After setting up our player movement, the player is able to move outside of the bounds of the Main Camera. This is obviously not desirable (or is it?... you be the judge!), so we need to confine our player to stay within the camera's view.
We could have the camera follow the player, but that breaks my design. Instead, I just added 2 new empty GameObjects, gave them BoxCollider2D objects, and using the tool in the Inspector, dragged the bounding box to be the length of the camera on the top and bottom edges.
4:02 Spawn Obstacles
Before we talk about spawning or instantiating any obstacles, we need to first make an obstacle to use! Reusing the same 64x64 pixel square as the Player, I scaled it up 5 in the x, and 5 in the y. I also colored it Red, and added a BoxCollider2D component with Is Trigger checked to True.
It's important to add a tag to these Obstacles, so I created a new Tag called... well, "Obstacles" and assigned it. I then made sure there was an Obstacle GameObject nested under each Background GameObject.
To spawn these Obstacles, at the start of the game as well as every time a background image resets its position, I fetch the Obstacle GameObject by using the background's transform's GetChild method. I then simply set the Obstacle localPosition (important when working with nested GameObjects) to a new Y position between -3 and 3. I determined these values by dragging the obstacle in the editor to the top and bottom edges of the camera and rounding to the cleanest number.
I wanted to give a short demonstration of how it could be done, but I think here is where you will need to expand things in your own project to really make it... interesting.
4:44 Obstacles destroy Player
The last thing we need to do is modify our PlayerController script to make it so if a Player collides with one of these Obstacles, then the game ends. Using the tag setup in the previous step, within our OnTriggerEnter2D event, we can check the other gameObject's tag if it's "Obstacle" and if it is, Destroy the player.
4:54 You did it!
Way to go Lil Noober! If you struggled to get to here and have questions, leave a comment or join our discord and post in our problem-solving channel!
#bmo #unity #tutorial

Пікірлер: 224

  • @terabyte9709
    @terabyte97092 жыл бұрын

    People do speedruns while playing games, this dude does a speedrun making games. A True LEGEND

  • @Billman07

    @Billman07

    2 жыл бұрын

    Build different...

  • @notbotpot7559
    @notbotpot75593 жыл бұрын

    I love your tutorials so much I watch them when I'm not even trying to make a game

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    You're the best!

  • @notbotpot7559

    @notbotpot7559

    3 жыл бұрын

    @@BMoDev no you are also thank you so much your discord is really helpful

  • @belalmansour1450

    @belalmansour1450

    3 жыл бұрын

    Yh I'm trying to make a completely different game but I thought oh well I might as well watch it

  • @amandacollins7392
    @amandacollins73923 жыл бұрын

    Didn’t think this video could get more helpful until I clicked on the description box! You are the real tutorial MVP!!

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    :D

  • @IceCream-sb7lc

    @IceCream-sb7lc

    3 жыл бұрын

    BMO! I never knew that you had such detailed descriptions....I too believe that you are the real MVP

  • @deadbroadcastpc
    @deadbroadcastpc3 жыл бұрын

    Man these 5 minute videos are what’s up! Straight to the point and informative. Can’t wait to see more my friend.

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Thank you, appreciate you 🙏

  • @LaurisG_

    @LaurisG_

    2 жыл бұрын

    God bless "Pause" button! :-D

  • @neenaw
    @neenaw3 жыл бұрын

    This is a super concise and easy way of doing this. I've never actually tried this but I totally should. Great video!

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Appreciate it! Yeah give it a shot, once you get the foundation in place you get to solely focus on content - quick to prototype compared to some other genres.

  • @Wotan363
    @Wotan3633 жыл бұрын

    I really love this tutorial, cause it covers the basics in a short amount of time, is also easy and good explained, espesially when u just take a look into the description :D thank u

  • @Daniel_He09
    @Daniel_He092 жыл бұрын

    the repeat background part is just what i needed!

  • @eileeng2492
    @eileeng24923 жыл бұрын

    Glad to be one of the first to catch it. I'm actually learning alot from these videos. Cool👍

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Thanks!

  • @Irishpierre1
    @Irishpierre13 жыл бұрын

    Super fun 5 min tutorial! Really sets the groundwork for a really fun game!

  • @syedmoin7939

    @syedmoin7939

    3 жыл бұрын

    kzread.info/dash/bejne/f2h5xtNmZKioodI.html

  • @BloodBathFenix
    @BloodBathFenix3 жыл бұрын

    Bro This was BRILLIANT

  • @JSCR1
    @JSCR13 жыл бұрын

    Doctor: Sir, you have 5 minutes to live. BMo: Open up Unity, and get this project started.

  • @peeei7423
    @peeei74233 жыл бұрын

    this is amazing!!!

  • @omarmagdy1075
    @omarmagdy10753 жыл бұрын

    Great tutorial really helpful

  • @yooalinutza17
    @yooalinutza172 жыл бұрын

    Great video! It was really helpfull!

  • @slmusic1993
    @slmusic1993 Жыл бұрын

    Awesome tutorial bro, applied the same concept to 3d objects and came up with a similar result.

  • @NobodyAtAll420
    @NobodyAtAll4203 жыл бұрын

    I got it to scroll vertically by changing this stuff. public new BoxCollider2D collider; private float height; private float scrollSpeed = 0f; height = collider.size.y; (scrollSpeed, -2); If (transform.position.y < -height) Vector2 resetPosition = new vector2(height * 0f, 40;

  • @Hollowdude15
    @Hollowdude15 Жыл бұрын

    Great video man :]

  • @kennedydike2970
    @kennedydike29703 жыл бұрын

    Great Tutorial!

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Thanks!

  • @carsonpaige9306
    @carsonpaige93062 жыл бұрын

    Thanks for this, it helped me out a lot

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Awesome

  • @BennysRadio
    @BennysRadio3 жыл бұрын

    I just did it! It took me 30 minutes though, I was a bit picky with my background a player character ^^ Great job, its great to let people do something in the engine that works!

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Nice job! Feel free to share on the discord (only if you want to), I'd like to see how yours came out 👀

  • @dhruvdornal6381

    @dhruvdornal6381

    3 жыл бұрын

    Bruh did you made the same game or changed the character and obstacles ? And from where did you get the objects

  • @BennysRadio

    @BennysRadio

    3 жыл бұрын

    Dhruv Dornal 8D Songs you can get free sprites at sites like opengameart.org or kenney.nl to let your prototypes look nicer. I made basically the same game and to get back to the engine after some breaks and changed just some minor things. Never shared it though.

  • @dhruvdornal6381

    @dhruvdornal6381

    3 жыл бұрын

    @@BennysRadio ok so we can add character and obstacles like subway surfer games for free ?? Right

  • @BennysRadio

    @BennysRadio

    3 жыл бұрын

    Dhruv Dornal 8D Songs depends on the license the creator posted it to the sites. On opengameart you can see the licensing model on the left side. If somebody posted a subway surfer like set and give it away for free with for example the public domain license, than yes. But some licenses require things to do. Like mention them in the credits or linking to them. It’s all explained in the license mode they choosed.

  • @OkPandaYT
    @OkPandaYT2 жыл бұрын

    this man is just built different

  • @santiagojuarez1289
    @santiagojuarez12893 жыл бұрын

    You sound like brackets jaja, love your tuts. Keep the great work bro 💪

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Really?? But I'm not Danish 😁 Thats certainly a compliment to me - appreciate it!

  • @noparkingnoparking
    @noparkingnoparking Жыл бұрын

    this worked thanks

  • @galeelraglen
    @galeelraglen3 жыл бұрын

    Thank you :)

  • @LongButtocks
    @LongButtocks3 жыл бұрын

    Hi, love the tutorial. I have a quick question, how would you go about adding more background images linking next to each other rather than just one stagnant image that loops? I want to have about 3 scenes of different backgrounds, it can be something like background 1, 2, 3 then loop.

  • @katerynaivinska658
    @katerynaivinska6583 жыл бұрын

    Thanks for tutorial! I have question. After adding backgroundscroller script did you do something in inspector? Like adding value to collider and rb or it just none?

  • @RandomGuy-df5us
    @RandomGuy-df5us3 жыл бұрын

    Love your vids it's simple yet very informative

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    :)

  • @Rovsau
    @Rovsau2 жыл бұрын

    Subbed!

  • @enciontioar
    @enciontioar3 жыл бұрын

    hiya, thanks for the tutorial! although i think i did something wrong, the player just phases through the obstacle, is there a way to either show a game over screen or to make the player reset/disappear?

  • @arpityadav4518
    @arpityadav45183 жыл бұрын

    my obstacle resets before it goes out of the screen , im using 3 backgrounds and i did width*3 too but still obstacle gets resets early please help

  • @billkasperdotcom
    @billkasperdotcom3 жыл бұрын

    I'm working on a game called "I have ADD". I'm learning Unity 5 minutes at a time, max. Thanks!

  • @jason.arcuri

    @jason.arcuri

    2 жыл бұрын

    I’m learning the same way lmao; 5-10min Unity videos are now built into my daily school routine

  • @lycoebitner4287
    @lycoebitner42873 жыл бұрын

    thankss :D

  • @realworldvlog1
    @realworldvlog1 Жыл бұрын

    Thats good

  • @mikekonstadinidis4498
    @mikekonstadinidis44983 жыл бұрын

    the script of backgrounds didnt work , i follow same steps and make everything the same way ,an (expected) error dont let me play the demo of the game some help pls

  • @egeozz

    @egeozz

    3 жыл бұрын

    Yes Same

  • @BaoTran-jo8lj
    @BaoTran-jo8lj2 жыл бұрын

    hey can I ask you what theme color you're using in the VSC IDE ? thanks

  • @definarte
    @definarte Жыл бұрын

    if your background does not fit into the camera, reduce the camera size to 4 and it should work 👍 thanks for the video!

  • @Shantal585
    @Shantal5853 жыл бұрын

    when i do the repeating background it functions properly but when it resets like the border tears and you can see the background

  • @syedmoin7939

    @syedmoin7939

    3 жыл бұрын

    kzread.info/dash/bejne/f2h5xtNmZKioodI.html

  • @megaminx96
    @megaminx963 жыл бұрын

    I don't know if someone has the same problem, I followed the tutorial and everything works. Then I added a new method to spawn obstacles in different pattern. The problem is that everything start to wobble / shake, even thought I setted a constant speed like in the video

  • @whitesheep1417
    @whitesheep14172 жыл бұрын

    I tried the background code but i got the error: Embedded statement cannot be a declaration or labeled statement. Does someone have any idea how i can fix this because i have no clue i just started programming.

  • @omerreyli195
    @omerreyli1953 жыл бұрын

    Help pls, if i go to unity there is a "the name scrollspeed does not exist in the current context" at the bottom left. Someone explain pls. Thanks

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    You have a typo most likely. Can you share your script?

  • @killinganime5104
    @killinganime51042 жыл бұрын

    @BMo what do you use to edit the script

  • @highscore4866
    @highscore48663 жыл бұрын

    Nice vid man i subbed But tbh thats a very sly and crapy substitute for an obstacle spawner

  • @oak4417
    @oak4417 Жыл бұрын

    For anyone who has a problem with it not scrolling right and they are using a sprite, try setting width to the length of your object

  • @Kuiekuie
    @Kuiekuie3 жыл бұрын

    How do I make it so the Obstacle also spawns on the middle?

  • @Amvnedits
    @Amvnedits3 жыл бұрын

    I keep on getting error about background scroller I followed ur step by step but I keep on getting them

  • @lucasjacobs1739
    @lucasjacobs17393 жыл бұрын

    I got on the end an error of the word "other" how can I fix this?

  • @sankalpbhagat9904
    @sankalpbhagat9904 Жыл бұрын

    one word for u GOD

  • @1Fated
    @1Fated3 жыл бұрын

    What if wanted to move my player in the vertical axis. What do i need to change in the script to make it work??

  • @NobodyAtAll420

    @NobodyAtAll420

    2 жыл бұрын

    Either change the get axis to Horizontal or add another line of code the same as how you have it moving vertically but use the word Horizontal if there is an x change it to a y.

  • @FC12CGaming
    @FC12CGaming3 жыл бұрын

    The Movement and the wall is working but the sprites go underneath the background

  • @mekky8230
    @mekky82303 жыл бұрын

    How the hell do you make VisualStudio show the references above the variables? Been searching my ass off but can't find anything of use on the subject. Also... why aren't my variables turning green like yours? They just stay white... I'm working in the latest version of VisualStudio...

  • @nchtblut

    @nchtblut

    3 жыл бұрын

    SAME F

  • @Azazel.x

    @Azazel.x

    3 жыл бұрын

    You have to download extensions for that to work. Also He is just using another theme. The colours and such varies accordingly

  • @purjolokgaming8482
    @purjolokgaming84823 жыл бұрын

    Hey @BMo i think i have followed every step correctly but when I press play my obstacles always dissapears behind the background and I don’t know what to do???

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    You probably have the obstacles on the same sorting layer. Check in the Sprite Renderer in the inspector

  • @purjolokgaming8482

    @purjolokgaming8482

    3 жыл бұрын

    @@BMoDev thank you, i looken around a bit and finally i got it. Now everything works fine👍👍

  • @beccabigcca
    @beccabigcca3 жыл бұрын

    HI i follow step by step but when i played my background it is still in static form what should i do?

  • @beccabigcca

    @beccabigcca

    3 жыл бұрын

    its ok now but the image scroll incontinuously

  • @cheecha3
    @cheecha33 жыл бұрын

    Thank you ! I learned much from this tutorial. The only problem is i can't manage when i run into obstacle my rocket just pass it.

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Setting "IsTrigger" to true lets you pass through objects instead of collide, however if you are setting up the OnTriggerEnter2D method in your PlayerController to Destroy your player GameObject, it will have the same effect. If you don't want the obstacles to kill your player, but rather just collide with them, you may have to change the approach a bit.

  • @cheecha3

    @cheecha3

    3 жыл бұрын

    @@BMoDev Thanks, i have managed it. Now i'm struggling to add shooting to the player so i can also destroy obstacles. Have you got any clue what script to use? Thanks!

  • @peoofhunter5954
    @peoofhunter59543 жыл бұрын

    Im use your game and share itch io ?

  • @Massive-3D
    @Massive-3D3 жыл бұрын

    DAYUM!

  • @ItsMeHelel
    @ItsMeHelel3 жыл бұрын

    What is your VSCode theme?

  • @xsool-yl7us
    @xsool-yl7us2 жыл бұрын

    how did you code the scroller itself? like what app do you use?

  • @DoB7709

    @DoB7709

    Жыл бұрын

    From the logo on the top left of the coding screen i think he uses microsoft visual studio

  • @sipronikun
    @sipronikun3 жыл бұрын

    semih jsuis first avec ce projet

  • @SmashEmDEV
    @SmashEmDEV3 жыл бұрын

    Please help i am stuck it says: warning CS0108: 'backgroundscroller.collider' hides inherited member 'Component.collider'. Use the new keyword if hiding was intended. Please need help as soon as possible thanks.

  • @samlion7308

    @samlion7308

    3 жыл бұрын

    Change the name of your BoxCollider2D from "collider" to "bxcollider"

  • @JSCR1

    @JSCR1

    3 жыл бұрын

    @@samlion7308 What do I edit? Do I make BoxCollider2D into Boxbxcollider2D?

  • @samlion7308

    @samlion7308

    3 жыл бұрын

    @@JSCR1 they create a box collider 2d named collider, that's not a good name because "collider" is a reserved word

  • @jantheanimator
    @jantheanimator2 жыл бұрын

    I need help. The BackgroundScroller script doesnt show up in the place where you select a component.

  • @NobodyAtAll420

    @NobodyAtAll420

    2 жыл бұрын

    Drag and drop it onto the object and it should add it to the object automatically.

  • @NobodyAtAll420

    @NobodyAtAll420

    2 жыл бұрын

    Also you have to hit ctrl+S to save it in your code editor then go back to unity and unity should reload then it should be available if you copied it exactly and remember to save before switching back to unity.

  • @MirehManuh
    @MirehManuh3 жыл бұрын

    question as to why my obstacles are sticking to the right side am i doing something wrong

  • @pimonsolak3692

    @pimonsolak3692

    3 жыл бұрын

    Try to check the code with ResetObstacle and check thu numbers you have written there.

  • @thecanaeggplant2937
    @thecanaeggplant29373 жыл бұрын

    More videossss

  • @gamer310taka9
    @gamer310taka9 Жыл бұрын

    it so good i won my school best game

  • @RAIM_AHMED_TV
    @RAIM_AHMED_TV3 жыл бұрын

    hey my player passes from enemy without getting out please help!!!!🤔

  • @ammar_arain

    @ammar_arain

    3 жыл бұрын

    I have the same problem...that and my background glitches

  • @RikalicTR
    @RikalicTR3 жыл бұрын

    My player dont die what can i do

  • @osamaabuzayed2198
    @osamaabuzayed21983 жыл бұрын

    Idk why you have 2k subs you should have 2m

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Appreciate that 🙏

  • @dhruvdornal6381
    @dhruvdornal63813 жыл бұрын

    Btw I wanted to ask from where can I get a character like a human for my game ?? Can someone help me out

  • @fukaze2021

    @fukaze2021

    3 жыл бұрын

    there's a lot of freebies in itch.io

  • @maketolaughyou6402
    @maketolaughyou64023 жыл бұрын

    Can i get these scripts please ? Please tell where to find

  • @SliCooper
    @SliCooper2 жыл бұрын

    Ok so I follow the script word by word but when I start it the 2nd image resets exactly where my first image is. How do I fix that?

  • @kingcreatez4827

    @kingcreatez4827

    2 жыл бұрын

    that happens to me aswell, have you managed to fix it?

  • @N473

    @N473

    Жыл бұрын

    @@kingcreatez4827 Ended up fixing mine a while ago by just copying another background over and shuffling them around.

  • @ChupaChups2626
    @ChupaChups26263 жыл бұрын

    how do i make the player game over when touching the obstacle ?

  • @ChupaChups2626

    @ChupaChups2626

    3 жыл бұрын

    in the video, after the player hit the obstacle, the player is destroyed. but the game is not over. how to fix this ?

  • @pimonsolak3692

    @pimonsolak3692

    3 жыл бұрын

    @@ChupaChups2626 im asking the same question. The only thing i managed to do is when the player hits the obsatcle the game stops and nothing happens next. But still dont know how to make the game repeat.

  • @Reddit-stories404

    @Reddit-stories404

    2 жыл бұрын

    @Yuvaraja M I would recommend making a new scene and writing that when he collides it changes scene to a scene that says game over

  • @Josh51507
    @Josh515073 жыл бұрын

    Amoung is background?

  • @LemonTheWise347
    @LemonTheWise3472 жыл бұрын

    I was looking for a tutorial for an autoscrolling game and found one, but the man was speaking really slow, So I took advantage of the ability to change playback speed and turned it to 1.5. I didn't like the length of the video, so I found this one. My first thought was "Wow, this man is really going at it." I'm an idiot.

  • @ammar_arain
    @ammar_arain3 жыл бұрын

    Hello I'm trying to make a 2D endless runner game for a school project and I've did everything you did but my background scroller doesn't work and the player does not get destroyed when it touches an obstacle. I also need to make it for a phone so I'd also need a reset button, if anyone knows of any tutorials that can help me out please let me know.

  • @kingcreatez4827

    @kingcreatez4827

    2 жыл бұрын

    same with me, my background resets its position on top of eachother, did you manage to fix yours? if so please tell me how

  • @ammar_arain

    @ammar_arain

    2 жыл бұрын

    @@kingcreatez4827 Hope you find the solution though, best of luck!

  • @NubbyGamerYT
    @NubbyGamerYT2 жыл бұрын

    How to Fix this 'are you missing a using directive'

  • @qqq9542
    @qqq95423 жыл бұрын

    This is awesome!!! But what if i want to increase the difficulty of the game as time goes on? How do i generate more obstacles the longer the player stays alive? Thanks! :)

  • @NobodyAtAll420

    @NobodyAtAll420

    2 жыл бұрын

    You need an object pooling script to randomly call different objects.. At least that's what I've figured out so far. Hopefully this info helps lead you to find more info.

  • @pawanprince2088
    @pawanprince20883 жыл бұрын

    Bro are you a game developer Could u say. Your qualification As i need that for my future

  • @kcpr_l9205
    @kcpr_l92052 жыл бұрын

    Wtf none of my code doesn’t work it’s exactly the same I write it, I go back to unity and press play and it doesn’t do anything please help me I beg

  • @jantheanimator
    @jantheanimator2 жыл бұрын

    Im gonna make a video about it.

  • @krisztianpapp884
    @krisztianpapp8843 жыл бұрын

    What the program code? 🥺

  • @johnryanaparece8215
    @johnryanaparece82153 жыл бұрын

    I Love your tutorials but how do u make it into a mobile game?

  • @comikawn5147
    @comikawn51473 жыл бұрын

    Hey Can you make serie to make Game look like HOTLINE MIAMI

  • @mistertibbels1222
    @mistertibbels1222 Жыл бұрын

    Which Version???

  • @13daffaafaalihbimap.d9
    @13daffaafaalihbimap.d93 жыл бұрын

    why in my unity the hero doesn't destroy if hit the obstacle?

  • @13daffaafaalihbimap.d9

    @13daffaafaalihbimap.d9

    3 жыл бұрын

    please help me

  • @09SkyFrost
    @09SkyFrost3 жыл бұрын

    this is really a beginner friendly tutorial, thanks! its straight forward that I cant follow along, like wtf is wrong with my script its different than yours I have something going on like // start is called before the first frame update can u help me like wtf this is so hard to make and u only did it in 5 fukin minutes and I wanna die I followed your codes but it didnt worked help me, heelp, me

  • @fndusty4542

    @fndusty4542

    3 жыл бұрын

    you can delete the stuff like //start is called... and such, they don't do anything due to the double forward slash infront of the text. I am assuming that is what this guy in the tutorial did. You might need to go and find another tutorial on youtube on how to make the character move, as this guy only shows what to put into the script and not how to make the input (up arrow on keyboard to go up, vice versa for down arrow, etc.) hopefully that helps you.

  • @09SkyFrost

    @09SkyFrost

    3 жыл бұрын

    @@fndusty4542 Thanks dude, But im kinda confuse in these visual studio codes like first of all the // then he has something at the top of his code called reference? idk its so different than mine, im stressed out yesterday its like 1:00AM when I wrote that comment and he's like doing a speedrun instead of a tutorial

  • @fndusty4542

    @fndusty4542

    3 жыл бұрын

    @@09SkyFrost I can agree- this tutorial does feel like a speed run with some cuts. If your visual studio code looks different, don’t worry. The reference thing wasn’t at the top of mine and it had worked, just type in the codes he types in the brackets. Yours should still have “void start” and “void update” as a default, and just go from there with the video. When it gets to the player controller though, I recommend watching one of the videos he has linked in the description for that section. They should help with inputs and movement, as you are a beginner you may not have that set up.

  • @09SkyFrost

    @09SkyFrost

    3 жыл бұрын

    @@fndusty4542 Alright, Thanks!!! appreciate it 😁

  • @ammar_arain

    @ammar_arain

    3 жыл бұрын

    @@fndusty4542 I can't find any tutorials and I really need to do it for a school project, do you know any good tutorials that tells you how to make a good endless runner for android 2D??

  • @vadim4ikbuilds663
    @vadim4ikbuilds6633 жыл бұрын

    It doesn't work:(( please help me

  • @revinpasya4085
    @revinpasya40853 жыл бұрын

    scripct correct but cant move the player

  • @DonHart
    @DonHart3 жыл бұрын

    How to move it on Andriod?

  • @harkl3ss974
    @harkl3ss9743 жыл бұрын

    I keep getting CS0245 with 'Rigidbody2d' I have no idea what to do, 'New to coding' using System.Collections; using System.Collections.Generic; using UnityEngine; public class backgroundScroller : MonoBehaviour { public BoxCollider2D collider; public Rigidbody2D rb; private float width; private float scrollSpeed = -2f; // Start is called before the first frame update void Start() { collider = GetComponent(); rb = GetComponent(); width = collider.size.x; collider.enabled = false; rb.velocity = new Vector2(scrollSpeed, 0); } // Update is called once per frame void Update() { if (transform.position.x { Vector2 resetPosition = new Vector2(width * 2f, 0); transform.position = (Vector2)transform.position + resetPosition; } } }

  • @thesauce5517

    @thesauce5517

    3 жыл бұрын

    if you haven't figured it out yet on "rb = GetComponent();" you need to capitalize "2D" Code should be rb = GetComponent();

  • @Wolfnoir60
    @Wolfnoir602 жыл бұрын

    Mines says other does not exist in current context can someone help?

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Sure can you share your script?

  • @Wolfnoir60

    @Wolfnoir60

    2 жыл бұрын

    @@BMoDev never mind I’m just very blind and need to wear my glasses thank you

  • @pimonsolak3692
    @pimonsolak36923 жыл бұрын

    Great tutorial! But i would like to ask that how do i make th game repeat after dying?

  • @kakoushal
    @kakoushal3 жыл бұрын

    You sound like brackeys

  • @adomasjarmalavicius2808
    @adomasjarmalavicius28083 жыл бұрын

    is anybody else posting comments in case he makes a 10000 player battle royal ?

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    lmaooo I just might one day

  • @januuuu2900
    @januuuu29003 жыл бұрын

    0:37 how can i sellect 2

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Ctrl + Click

  • @januuuu2900

    @januuuu2900

    3 жыл бұрын

    @@BMoDev k

  • @thijsvanasten512
    @thijsvanasten5123 жыл бұрын

    my words don't have color what do i need to do

  • @Maximiliano7670

    @Maximiliano7670

    3 жыл бұрын

    Its fine they dont need color mine dont as well but it still works

  • @Gamer-nd5mz
    @Gamer-nd5mz2 жыл бұрын

    Assets\PlayerController.cs(25,7): error CS0103: The name 'other' does not exist in the current context how do i fix this void OnTriggerEnter2D(Collider2D col) { if(other.gameObject.CompareTag("Obstacle")) { Destroy(gameObject); }

  • @Haffey.z64
    @Haffey.z642 жыл бұрын

    does this work for mobile?

  • @YukioLucas
    @YukioLucas3 жыл бұрын

    what means f, in "-2f"?

  • @jellyhotdog4955

    @jellyhotdog4955

    2 жыл бұрын

    might be a bit late to reply but it means float

  • @Hobby555_
    @Hobby555_3 жыл бұрын

    i need the scroll script

  • @kjpalakshmirajthetalenteds5462
    @kjpalakshmirajthetalenteds54623 жыл бұрын

    sir is this a mobile game or a pc game???

  • @monsterboyx7076
    @monsterboyx70763 жыл бұрын

    can u pls make a how to move stickman with arrow keys and ad

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    Yeah I've gotten a lot of asks to do so, not sure if it will be my next video but I'll try to get to it.

  • @monsterboyx7076

    @monsterboyx7076

    3 жыл бұрын

    @@BMoDev thnks sooo much