How to make a simple T Rex endless runner game in windows form and c#

Поделиться
HTML-код
  • Опубликовано: 1 ноя 2024

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

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

    Download this project here github.com/mooict/T-Rex-Endless-Runner-Game-in-Windows-Form

  • @igorkamerzan
    @igorkamerzan 4 года назад +11

    Dude your tutorials are awsome. Others look like beautifully packed shit. But yours are straight coding. Thanks for all the things you do to us.

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

      *Awesome

    • @latte-k5k
      @latte-k5k Месяц назад

      @@bojohannesen4352 u replied a little bit late...man

    • @bojohannesen4352
      @bojohannesen4352 Месяц назад

      @@latte-k5k And?

    • @latte-k5k
      @latte-k5k Месяц назад

      @@bojohannesen4352 andd it doesnt matter if he spelled something wrong he was just complimenting the man + who asked for a correction

    • @bojohannesen4352
      @bojohannesen4352 Месяц назад

      @@latte-k5k When did I ask for YOUR opinion? Exactly. I didn't. And you gave it anyway. That's how comments work.

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

    Thank you
    I've just coded my first game in c# following your guide.

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

      First of many 👍

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

    Thank you so much for all the tutorials sir learn a lot compared to online class ❤️

  • @cska_hn
    @cska_hn 4 месяца назад +1

    Bro your tutorials are always good! Tks for showing me straight code. Hope you'll be better and better day by day.

    • @mooict
      @mooict  4 месяца назад

      Thank you ☺️

  • @jakubdrazkowski5780
    @jakubdrazkowski5780 3 года назад +10

    Bruh... I LOVE YOUR TUTORIALS!!!!

  • @anderssvenson5034
    @anderssvenson5034 5 месяцев назад

    Thank you for this tutorial you helped me pass my class

  • @karanveersingh5911
    @karanveersingh5911 Год назад +1

    It was amazing help in my project

  • @mad5411
    @mad5411 2 года назад +2

    Nise

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

    Thanks. Ive done it. Next stop will be your pacman.

  • @matteodragoni9108
    @matteodragoni9108 Год назад +2

    Useful!

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

      Glad it was helpful!

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

    Keep doing this Tutorials, You are perfect for beginners :)

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

    Thank u i really learned alot in this vid i think i would leave unity!

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

      Hi thanks for the compliment, these tutorials mainly cover basics of programming. if you are interested in games development I would strongly recommend learn and master unity.

  • @cokoprens5067
    @cokoprens5067 2 года назад +1

    thank you dude

  • @izio1111
    @izio1111 11 месяцев назад

    thanks for the content. kind of wish you were better at explaining cos i had such a difficult time learning this or even understanding.

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

    Very helpful! Thank you very much :)

  • @04-jayeshkumargupta8
    @04-jayeshkumargupta8 3 года назад

    Nice tutorials

  • @ivanpavaovucetic8276
    @ivanpavaovucetic8276 7 месяцев назад +1

    Thank you so much for this but is there a reason why the dinosaur is under floor while playing the game, can you please tell me what i did wrong

    • @mooict
      @mooict  7 месяцев назад

      You can check the trex.top value from the tutorial. For my one trex.Top = 367; in the timer and in the restart game function. You can also check the GitHub link for the project to view the full source code. Hope it helps.

    • @ivanpavaovucetic8276
      @ivanpavaovucetic8276 7 месяцев назад +1

      @@mooict Yes, I have corrected, thank You

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

    I'm really interested to know how you learned C#?
    What advice do you want to give to who is beginners ?

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

      Hi, my advise would be to make as many projects as you can try different ones from games design to application development. I went through the process of making games and apps since university and I enjoyed making things that worked for me. I didn't do any commercial apps just made stuff that I wanted and see if I can do it. It's challenging but growth in any skill is always challenging.

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

    @Moo ICT can you do it with the flying birds?

  • @tienhuynh2435
    @tienhuynh2435 2 года назад +1

    omg, thank you a lot

  • @ss-lol
    @ss-lol 4 года назад +2

    How did you get that “obstaclespeed”

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

      Its defined in the begining when we start programming in the project.

    • @ss-lol
      @ss-lol 4 года назад +2

      Moo ICT oh I see it. It works! Thank you for the amazing tutorials

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

    Interesting video but I can't quite get in 12:36 this foreach. What is "Control" and "this.Controls". I will be so thankful if you explain it. :)

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

      This will help - www.liangshunet.com/en/202002/498218422.htm

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

      @@mooict Thank you!

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

    i got everything right but the only thing that wrong is my dino, when i run the game it appear to be a black box above near the score label and cant be moved and score still inscrease :(

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

    Hey bro your tutorials are georgeous, can u help me pls? I want to make a trex can double jump and i dont know how

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

    So if I use another gif or png instead of the gif or png you use, will I get an error?

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

    Can i write this code in jetbrains?or only visual studio

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

    Thanks

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

    im a beginner and i didnt understand anything, i appreciate the working but should've explained more

    • @KoenigOne
      @KoenigOne 2 года назад +1

      after 24h, finally i can understand whats happening, i used the website for more information. You are a true legend

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

    Hello! The Trex simply doesnt appear when I run the code. It just vanishes. The obstacles are there. The dino isnt. Im 15 min into the video

  • @metalweb1895
    @metalweb1895 5 месяцев назад

    it tried the code and test it but it showed me a blank screen is there a way to fix it?
    the floor is not solid

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

    Really good tutorial! But your voice is a little too low!

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

    Do you open the unity project as 2D or what?

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

      No its WPF but i dont recommend you to make a game in wpf as a beginner

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

      This is Windows Form Application in visual studio. It's a different format of app than unity games. It is in 2d but we are not using unity we are using the .net framework to manually make a game rather than using s games engine.

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

      @@mooict Oh ok thanks, I'll leave a sub, cos this tutorial is epic (:

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

      @@mooict Oh ok thanks, I'll leave a sub, cos this tutorial is epic (:

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

    How do you get these images and Gif's for your projects?

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

      Some I found online and some of them I animated myself 😊

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

    My obstacles and Trex are nowhere near each other but the if (trex.Bounds.IntersectsWith(x.Bounds)) is constantly true when I start the game. I don't know why

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

      It shouldn't be constantly true only when both picture boxes are overlapping with each other. Check the for each loop, you should be checking the tags and intersection between both objects to detect collision

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

      Me too

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

    hey please help iam stuck i reacherd to min 20:57 my trex is moving with the obstacles i reviewd the video step by step but i coundnt find any mismatch with my code what could be wrong?????

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

      Check the t Tex tag in the properties, if there is a tag then remove it

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

      @@mooict yesss exactly thank you so much ... i dont know how it writen there i didnt write it u saved me

  • @NoName-rq8ec
    @NoName-rq8ec 3 года назад

    It works, but whenever I tried pressing space bar it closes itself instantly. Help.

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

    There is a bit of a problem where the obstacle's hitbox is slightly oversized, I think you can fix this by making the image's transparent

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

    Hello sir , this is my first time that I am making a game. I don't know why but I having problem with my obstacle, when I run the game the trex work finely but those obstacle don't move, they stay in same place!
    Do you have any idea how to fix it or where the problem is ?

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

      Hi check if you've tagged the picture boxes for the obstacles in the properties window.

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

      @@mooict i just fixed the problem now and thank you so much for helping me to solve the problem.

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

    Hi there. I encountered a problem while programming the game. I followed your tutorial very closely, but for some reason, the floor picture box doesn't shows up

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

      Did you add a picture box called floor to the form? check if that picturebox has any tags on it. Sometimes adding tags to the floor can cause it to move away from the form.

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

      @@mooict Thanks for your help. It seems like I accidentally added the obstacle tag to the floor. I fixed it now

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

    hey there. thank you so much for this cool tutorial. but for some reason the game isn't working even tho i have no erros. when I start the game nothing happens and when i press space also nothing happens. do you have any idea why this happens?

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

      Check the timer if it's enabled in the properties window.

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

      @@mooict The dino now moves. but for some reason he falls thru the floor. also thanks for the quick response.

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

      @@wouter9895 inside the timer event there's a part that checks for collision between the floor and the player see of it matches with your one and this tutorial code.

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

      @@mooict oke, now that works. but now my obstacles wont move xD. I'm sorry for all the questions.

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

      @@wouter9895 not a problem, see if you have added the tags to the obstacles in their properties window.

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

    I always get the cs1656 error and cs0108 warning with these keydown & keyup events

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

    Help, i have a problem! the first time the game works but if i die and reset the game the dino stops jumping (the cactus stills move) what can i do?

    • @mooict
      @mooict  2 года назад +2

      Could you check the game reset function and see if the Dino is resetting to the right position

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

      @@mooict thank you! Now it works

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

    Hello
    Score isn’t working it remains zero after jumping over hurdles
    Can you explain please

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

      Hi, check if the score integer is being updated on the label. inside of the timer even you can see a line like txtScore.Text = "Score" + score; this line is updating the label as the score is being updated.

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

    bro, How come everytime i run the game, the trex is not showing? But ain't got no error?

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

      Check the location for the T rex in the code. It’s located with trex.Left and trex.Top

    • @vergaraverniel1416
      @vergaraverniel1416 Год назад +1

      @@mooict i fixed it, thank you so much

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

    My dinosaur is in the wrong place when I run the code. It is in the right place in the design tho!

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

      Check the location of the trex picurebox in the reset function see if it matches the tutorial

  • @casual-mtb-veiwer_782
    @casual-mtb-veiwer_782 Год назад +1

    I have almost finished making flappy bird using only the console as the display. Very inefficient

    • @mooict
      @mooict  Год назад +1

      That’s amazing. The fact it can be done in console and YOU are doing is amazing all to itself.

  • @shahzadali722
    @shahzadali722 6 месяцев назад

    Game is Not restart by pressing R.
    Guide me How to restart the game

    • @mooict
      @mooict  6 месяцев назад

      Game restart parts starts on 25:09. From there we are adding the game over function to the timer and then adding the other instructions inside of key up event. Hope this helps.

  • @Naman.aggarwal09
    @Naman.aggarwal09 4 года назад

    dino rex was bottom in the black picture box what i do now

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

      Hi I'm not sure what you mean, is the t rex not stopping on the ground after the jump?

  • @Dream-rs7jh
    @Dream-rs7jh 3 года назад

    can anyone help when i go to right trex.top it doesnt work

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

    Hey! I have a problem. When I run the code an empty form without pictures appears, plz help me((((((((

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

      Does your code has this Form constructor. If not add it to the code see if that helps.
      public Form1()
      {
      InitializeComponent();
      }

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

      @@mooict so now everything is ok but my Trex image is not appears, when is bump into the obstacle image is appearing. Problem CS0117 "Resources" doesn't have description for "Running"

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

      @@aleksandranedosekina8990 see if you've imported a image called running in the project.

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

      @@mooict i need tag or call pictureBox with Trex "running"?

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

      @@aleksandranedosekina8990 there should be an image called running for the t rex. Import that to the project and the resource error will go away.

  • @joseflores-fv7fk
    @joseflores-fv7fk 2 года назад

    tengo el personaje T Rex pero no me sale el piso negro en donde tiene que pisar el T Rex le di iniciar pero cuando inicio el juego solamente sale el T Rex con la pantalla en blanco y no el piso negro

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

    how do i create a way to save players score and make a highscore ?

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

      You can easily save them into the file in game directory (using streamwrite and streamread)

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

      @@czhockeyfan leaderboard style

  • @Youtuber-sq9yz
    @Youtuber-sq9yz 4 года назад

    I got half way through and followed it exactly and have 70 errors already. plz help

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

      What's the errors?

    • @Youtuber-sq9yz
      @Youtuber-sq9yz 4 года назад

      well there are a lot haha. But its pretty much saying that pretty much everything is an invalid token so i don't really know whats happening.

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

      When I usually get errors like this I check if I missed any brackets. Sometimes missing the brackets cause cascading errors through out the code.

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

    coud u talk louder thanks for ur tutorials

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

      Hi sorry about the audio quality on this I will fix this issue for future videos. For now you can use the volume booster browser extension if that helps.

  • @04-jayeshkumargupta8
    @04-jayeshkumargupta8 3 года назад

    He sounds like georgenotfound

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

    - Привет! У меня такая проблема - игра работает нормально, но игровые очки не считаются! сделали все так, как описано на сайте...

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

      Hooray, I figured it out myself! Thank you for publishing such an interesting project!

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

      Well done 👍 and I'm glad you enjoyed it

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

    you sound depressed, you ok there fam?

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

      leave the poor guy alone . no boolie pls

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

    would you mind giving me your mail address so that i can send you my code to help to check?
    i have followed each step carefully, and have checked that there should be no problem, but when i execute the app, it's not what it supposed to be, the trex is beneath the black bar, when i press space, it just jumps out. in addition, it's weird that the obstacles don't do anything
    thanks in advance if you can help me out

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

      Hi, here is the GitHub Repo for this project, github.com/mooict/T-Rex-Endless-Runner-Game-in-Windows-Form you can download it all and open it in visual studio. Hope that helps.

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

      @@mooict thanks, i did it, i execute your project, it's better that it can be played, but the trex still doesn't show up correctly in the initial position. i can just see its head, it's body is covered by the black bar. i didn't change anything, i don't know why it works like that

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

      @@forever_6 see if you have the same line as this trex.Top = floor.Top - trex.Height; in your code.

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

    Y is ur voice soooooooooo low?

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

    Bei mir kommen imme rnur 2 kakteen, kann mir jemand helfen?

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

    Can you pls help me?

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

      Hi what's the issue?

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

      @@mooict Hey, can you explain me the MainGameTimerEvent part? (What the MainGameTimerEvent is and for what all the ifs and elses stand for)

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

      @@mooict Id really appreciate it. Tomorrow I have a presentation about this and I dont get the MainGameTimerEvent part.🙁

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

      @@juicynews0 Hi, the main game timer event is the TICK event for the timer. For this game the timer interval is set to 20 milliseconds so this event is called every interval or tick. We control the main game logic from inside of it for example the jump, landing on the ground, obstacles moving and replacing and finally updating the score. The timer will need to be enabled for all of this to work. All the best with your presentation tomorrow.

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

      @@mooict Thank you so much man. I have another question about the MainGameTimerEvent. Can you explain me, for what the first IF, second IF , the else and the last IF stand for? (What we check in the ifs and else)

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

    its too laggy .....when i play game

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

      Check the timer interval and set the interval to 20

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

    Howto convert exe

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

      You can find your exe file in the debug folder inside of the visual studio project folder.

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

    el dinosaurio se lo chupa la tierra

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

    you don't explain properly

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

    Love your tutorials! I followed this one but I got a few issues:
    1 ==> trex.Image = Propreties.Ressources.dead;
    2 ==> trex.Image = Propreties.Ressources.running;
    they both dont work and it says that the ressouces doesn't contain a defenition for the words running and dead.
    Also ==> txtscore += " Press R to restart the game!";
    it does not work and it says that it cannot implicitly convert type 'string' to 'System.Windows.Forms.Label'
    I tried to run the game without those lines and it partially worked. The obstacles and score worked, but every time I lunched it the trex went down and disappeared from the form.

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

      Hi, for the first two errors relating to the resources means your project doesn't have a image named running or dead imported to the project. If you downloaded and imported the images from the website that will solve that. The other error needs to state txtscore.Text += " Press Enter to restart". It's important to change the text property from the label not the label itself. If you try txtscore == "something" it will show an error because c# thinks you are trying to change the label itself to a string so you need add txtscore.Text to it and it should work. Hope this helps ☺️