Unity Tutorial How To Make Simple Slot Machine Game For Android Platform

Поділитися
Вставка
  • Опубліковано 27 січ 2025

КОМЕНТАРІ • 237

  • @deanscott8165
    @deanscott8165 2 роки тому +6

    I followed this tutorial recently and now I have a really nice slot game with 3 different reels and a bunch of other cool stuff! Thankyou for this, very helpful!

  • @donnyestee
    @donnyestee 5 років тому +10

    You can do the long if/else structure better by just using a loop.
    Count the amount of times "Seven" or "Cherry", etc. appears.
    If it appears 2 times it means you won, if it appears 3 times it means you won even harder.
    Then after that, multiple the points with whatever value it was. For example x2 is it is Bar, or x3 if it is Cherry.

    • @AlexanderZotov
      @AlexanderZotov  5 років тому +1

      Cool! Thanks for your suggestion!

    • @Mario-xl6ii
      @Mario-xl6ii 5 років тому

      Donny Estee Can you help me pls pls 🙏🙏🙏🙏

  • @leonardlin703
    @leonardlin703 6 років тому +7

    Thanks for the tutorial Alexander! I simplified the group of if else statements in CheckResults a little by checking for 3 in a row first. The doing a switch statement.
    if (row1Result == row2Result && row2Result == row3Result)

  • @nemanjamarkovic9818
    @nemanjamarkovic9818 6 років тому +1

    Great and amazing job mate, i have done step by step and it worked, keep up the great work and i wish you a great new year and happy holidays :D

  • @dharmeshkumar2763
    @dharmeshkumar2763 6 років тому +2

    Nice tutorial. I will use this in my next game to give reward to player. One more thing. After every tutorial content quality is increasing.👍👍👍. Nice work. 👍👍👍

  • @zacks_drums
    @zacks_drums 5 років тому +1

    Very awesome tutorial and breakdown Alex!! :) I'll try to optimize the prize check (any 2 and 3 of a kind) code, and this is a nice little challenge

    • @AlexanderZotov
      @AlexanderZotov  5 років тому +1

      Thanks ;-) There are a couple of suggestions about code optimizing already in the comments by the way.

    • @rodrigoluka453
      @rodrigoluka453 3 роки тому

      I realize I'm kinda randomly asking but does anybody know a good website to stream new series online ?

    • @chaimclark1519
      @chaimclark1519 3 роки тому

      @Rodrigo Luka I dunno I watch on flixportal. You can find it thru google :P -chaim

    • @rodrigoluka453
      @rodrigoluka453 3 роки тому

      @Chaim Clark thank you, signed up and it seems to work =) I really appreciate it !

    • @chaimclark1519
      @chaimclark1519 3 роки тому

      @Rodrigo Luka You are welcome xD

  • @m.hoseinnajafi5438
    @m.hoseinnajafi5438 5 років тому +1

    The higher this value is ... The smaller game object appears...
    SUCH A POEM

  • @jere8925
    @jere8925 12 днів тому

    Nice tutorial! It works almost perfectly. The only problem I have is that when I build the game, I can’t see the prize text anymore. In the editor, though, it works fine.

  • @ZefiDev
    @ZefiDev Рік тому

    Thank you So much for this tutorial needed it so much bro!!

  • @munirabbas469
    @munirabbas469 6 років тому +1

    You are great among other Unity developers. I learnt lots of by your way. thank you

  • @eyeprops5422
    @eyeprops5422 5 років тому +3

    Followed your example ... thanks ... In order to get around the code for the results, I just made an "integer" array to store if the locations matched.
    If it did it would increment the value in the "integer" array. I also have another array of the "Names" of all the possible results.
    Since both arrays are the same in length .... I can compare the value in one array to the next.
    So if "Apples" are the first item in the "Name" array ... and the first item in the "integer" array is a two... then i got two "Apples"

  • @aminebirje4714
    @aminebirje4714 10 місяців тому

    thank you , easy to understand and follow , you got a new follow !

  • @dennisgonzales9521
    @dennisgonzales9521 5 років тому

    Lovely! As always great content

  • @random_precision_software
    @random_precision_software 6 років тому +2

    Thank you, I've been looking for a slot machine game

  • @prevratnik
    @prevratnik 6 років тому +2

    Great! Very informative!

  • @erkankumral8988
    @erkankumral8988 2 роки тому

    Alexander thank you very much. Just the video i need.

  • @publicstaticvoid3224
    @publicstaticvoid3224 5 років тому +2

    **Well done Alexander 👍**

  • @LemauDev
    @LemauDev 6 років тому +1

    really love it bro , thanks :*

  • @Zade-26
    @Zade-26 6 місяців тому

    My [SerializeField] private Row[ ] rows; comes with a namespacing error, but I followed the script to the letter.

  • @gamesmunch
    @gamesmunch 6 років тому +2

    you help me a lot for learning unity thanks

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      You are welcome! Thanks for watching :-)

    • @gamesmunch
      @gamesmunch 6 років тому

      sir can you tell me i use interstitial ad in app that is not publish in play Store and the revenue that is generated from this app is legal or ad mob allow this because i have no developer account i made game and i publish my game in different social media and in my page that is made for my game it is legal or not. Because i am a student and i have not enough money to buy a developer account please tell me i its legal then i make more games otherwise i can not wast my time

  • @shmoo42
    @shmoo42 2 роки тому +1

    Great video! I am wondering how can I add a scoring system that adds and subtracts the prize numbers. Is there a simple fix for that? I wonder if you have a tutorial on that maybe

  • @jhaymarz21
    @jhaymarz21 5 років тому +11

    Do you have the full script available to share for learning only. Thanks

  • @abotto5667
    @abotto5667 6 років тому +1

    Amazing work,as ever.

  • @iansong1676
    @iansong1676 6 років тому +1

    Great video!!

  • @Sleepytime11.11
    @Sleepytime11.11 3 місяці тому

    How do you connect wallet to this. Pay in and pay out ?

  • @wignermatos1470
    @wignermatos1470 6 років тому +1

    Great video !

  • @CowboyCanadian
    @CowboyCanadian 9 місяців тому

    where is the code so that I dont have to type everything? maybe i missed it but i did not find it anywhere in the description of the video.

  • @Arpitdala
    @Arpitdala 8 місяців тому

    please someone give me project files ive tried everything but the row never go to theri place they are always diferent

  • @hirannair5041
    @hirannair5041 2 роки тому

    Okay so I have a slot with numbers from 1 to 10 and I want to spin it with the button pressed. How to do that?

  • @Adonys
    @Adonys 6 років тому +2

    Hey! I've been watching your tutorials for a while and i think they're pretty great! I have a tutorial idea for you. Could you do a button that unzooms when you click on it and when you unclick, it rezooms at normal zoom. Thanks!

    • @AlexanderZotov
      @AlexanderZotov  6 років тому +1

      Thank you! I'll think about it.

    • @Adonys
      @Adonys 6 років тому

      @@AlexanderZotov 😁

    • @RootsterAnon
      @RootsterAnon 4 роки тому +2

      @@AlexanderZotov I just wanna know... did you think about it? :D

    • @lucifair6919
      @lucifair6919 2 роки тому

      @@AlexanderZotov did u think about it?

  • @sofronijeandjibulovic3616
    @sofronijeandjibulovic3616 Рік тому

    I have different positions for transform.position.y in unity and mobile device. How to fix it?

  • @innomotionmedia4039
    @innomotionmedia4039 5 років тому

    i press the handle and it does its thing but the rows dont rotate... just the handle moves. did everthing you said ... ?

  • @KATCHgaming
    @KATCHgaming 2 роки тому

    It the same system for making a '' open case '' or '' mystery box of skins'' in a FPS Game ?

  • @markusmeier4073
    @markusmeier4073 5 років тому +1

    can someone help me my row does not stop spinning and in Row.cs the lines from 41 to 90 are marked as "unreachable code detected".

  • @JugaduGeek
    @JugaduGeek 6 років тому

    Brother is it possible to change the button sprite on runtime in unity i am making a shop section and for this i need my player to change into certain shapes so can you help me

  • @periklisk.8194
    @periklisk.8194 4 роки тому

    Well in the end, when i drag n drop the script into the GameControl , it doesn't show me the prize text and the elements where i should put the rows. Any idea why is this happening?

  • @psy_gamer
    @psy_gamer 6 років тому +5

    Действительно хороший туториал! Так как на всем Ютубе нет ничего подобного! Спасибо!)

    • @AlexanderZotov
      @AlexanderZotov  6 років тому +1

      Спасибо! Да, со слот машинами напряженка.

  • @64imma
    @64imma Рік тому

    11:48, here's an idea I have
    Create an array of the string representation of each of the possible values. Also create 2 dictionaries. 1 dictionary to pair up each string with its 3 symbol value, and another for it's 4 string value. In the check results method, we iterate over the array of strings, first checking if all 3 equal that symbol, then if at least 2 equal that symbol. Obviously, we would want to put a break statement if either of these scenarios is true for a particular symbol. Then if the 3 symbol possibility is true, we access the 3 symbol dictionary to get the correct value, and set prizeValue to that value. Access the 2 symbol dictionary if that situation is correct. As a general rule, we want to stay DRY when writing code.

    • @64imma
      @64imma Рік тому

      Also, you probably would want to create an enum for the different symbols, and set values based on that enum, rather than doing a string representation. You can easily create an array of these from the enum type.

  • @chakhenry2026
    @chakhenry2026 3 роки тому

    hi I want to know why Random.Range is (60,100) ? if I wanna change how can I change the Range?

  • @mikotv9836
    @mikotv9836 6 років тому +1

    After making my android game, in my phone says like "error unable to initialize unity engine" please help me!!!!😣😣😣😣😣

  • @diegosuarez5473
    @diegosuarez5473 6 років тому +2

    you are GOD? your work is amazing! thanks, in my game you have one place on the credits bleive me!! :D

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      Of course I am ;-) Can't wait to see your game! Thank you!

  • @aniketcoder1469
    @aniketcoder1469 3 роки тому

    Sir please answer I put the code correctly but I got the 155 errors
    Rows does not contain a definition for stoppedSloat and no accessible extension method stopped Sloat accepting a Frist argument of type rows

  • @preflopstore9718
    @preflopstore9718 4 роки тому

    Fantastic!!!

  • @kelvintx3
    @kelvintx3 4 роки тому

    Hi, Thanks for creating the video. May i know which part of the code control the spinning animation?

  • @gamesdisk
    @gamesdisk 4 роки тому

    So the row switch stantment can be replaced with
    random += (3 - (random % 3));
    my scale was bigger, so instead of having lots of switches. I used
    random += (7 - (random % 7));
    it makes the spin last for one extra spin if the number is base 7 though.

    • @romazriaz5141
      @romazriaz5141 3 роки тому

      i need help if you provide your slot machine project

    • @deepanshumanocha3629
      @deepanshumanocha3629 3 роки тому +1

      Hey, Switch Statment in my project is not working can you help?

  • @ahmetalpsayin
    @ahmetalpsayin 5 років тому +1

    for results check method, I have implemented following code ;
    private void CheckResults()
    {
    //if number1 row equals to both number 2 and number 3 it means 2 and 3 also equals meaning we dont need to check them seperately
    if (rows[0].stoppedSlot.Equals(rows[1].stoppedSlot) && rows[0].stoppedSlot.Equals(rows[2].stoppedSlot) )
    {
    switch (rows[0].stoppedSlot)
    {
    case "WaterMelon":
    prizeValue = 300;
    break;
    case "Cherry":
    prizeValue = 200;
    break;
    default:
    break;
    }
    }
    resultsChecked = true;
    }

  • @ChanchitorosadeMia748
    @ChanchitorosadeMia748 4 роки тому

    Hello friend, great work! Inquiry, is it normal that I only let you pull the handle once?

  • @pathvoid70
    @pathvoid70 4 роки тому +2

    please give me the full project link sir only for learning please

  • @skywoker123456
    @skywoker123456 6 років тому +1

    отличный урок, побольше бы таких.

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      Спасибо! Я над ним работал неделю ;-) Хотелось бы побольше таких, но очень утомительно :-)

    • @skywoker123456
      @skywoker123456 6 років тому

      @@AlexanderZotov Ну, главное качество, а не количество.

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      Сложный вопрос ;-) Качественное количество :-)

  • @arielgimenez_95
    @arielgimenez_95 5 років тому +5

    Hi, could you share the complete unity project?

  • @Subhajit
    @Subhajit 3 роки тому

    perfect video .how to add sound when the handle pull up?

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому +1

      I have several videos about sounds.

    • @Subhajit
      @Subhajit 3 роки тому

      @@AlexanderZotov I understand your teaching.. thanks a lot

  • @dfilitto
    @dfilitto 3 роки тому

    Good video.

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому +1

      Thank you!

    • @dfilitto
      @dfilitto 3 роки тому

      @@AlexanderZotov can you create a cupom of your course in udemy for i POST in my group?

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому

      Sure, why not

  • @MahmutSeh
    @MahmutSeh 6 років тому +1

    Hi, how did you create a tutorial for how to play the game we developed? (unity)

  • @taeworldcj6998
    @taeworldcj6998 6 років тому +1

    Hey ive been struggling with this one. I myself and my partner have both looked through the code and it looks identical to what youve shown but nothing is working. is there any way i can get in contact with you and maybe send you over my code so you could take a peak at it and let me know where i went wrong?

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      Hi! What exactly doesn't work?

    • @taeworldcj6998
      @taeworldcj6998 6 років тому +2

      @@AlexanderZotov currently nothing works the handle doesnt rotate and the reels dont start spinning

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      It's hard to say just like that what is wrong. The best way to figure it out is to take a look at the whole project.

    • @crashzzalex9218
      @crashzzalex9218 4 роки тому

      @@taeworldcj6998 Same for me

    • @elpigmanq110
      @elpigmanq110 3 роки тому

      same. nothing works at all

  • @dylanwarwick4429
    @dylanwarwick4429 4 роки тому

    For the long if/else mess, I used a switch on the middle slot, an enum ordered by most expensive to cheapest (highest prize to lowest), and a secondary function that just checks rows[0] for a match, rows[2] for a match (and both again for 'extra reward' on a triple match), then returns matchCount * enumValue * 100; where matchCount is the checks above and enumValue is just the (int)enumParameter. The returned value is shoved into prizeValue.
    Note however then the prize values will be the result of a function and not hardcoded, but you can make it hardcoded with set values by altering the secondary function, even making a tertiary function for reward values, which would separate match searching and reward output, two separate tasks in checking results anyways. More maintainable code.
    One could also define the values in the enums to be something binary-esque (not actually binary, ternary maybe, because you want unique values for all combinations of the following calculation and there's 3 possible values of matchCount) and calculate matchCount*enumValue then search for that value in some lookup table instead.

  • @R4du21
    @R4du21 5 років тому

    Why it says that: "error CS0246: The type or namespace name 'Row' could not be found (are you missing a using directive or an assembly reference?)", I made it exactly like you.

    • @iulianlordpyro490
      @iulianlordpyro490 5 років тому

      Row is another class and same classes need to have the same namespace if u have a namespace already

    • @R4du21
      @R4du21 5 років тому

      @@iulianlordpyro490 If I put a link to the code can you help me? I'm new to programming.

  • @walney2008
    @walney2008 5 років тому

    tnks good game, you speak game bingo ? and generation cards ?

  • @dragonballzfan315
    @dragonballzfan315 6 років тому +1

    Awesome :)

  • @dahuzihaidao
    @dahuzihaidao 2 роки тому

    nice video! Would you mind to make a tutorial for 3x5 slot game please? I would like to pay for that👍

  • @8978martin
    @8978martin 6 років тому

    you can do that if the button is pressed the machine the band of the machine stops

  • @Sasan_Soroush
    @Sasan_Soroush 6 років тому +1

    You are amazing

  • @iulianlordpyro490
    @iulianlordpyro490 5 років тому

    Would you help me with some smooth rotation? seems so robotically... How I can create a smooth rotation?

    • @Mario-xl6ii
      @Mario-xl6ii 5 років тому

      It won't work with me.
      can you help me?

    • @iulianlordpyro490
      @iulianlordpyro490 5 років тому

      @@Mario-xl6ii need more details

    • @Mario-xl6ii
      @Mario-xl6ii 5 років тому

      Iulian LordPyro Can you Send me a dm ok Discord ? My id
      VyocsHD#9470
      thx thx thx

  • @apnadekhtu
    @apnadekhtu 5 років тому +1

    How about to teach on joints?? Hinge and all other? One video per joints with practical.??

  • @sngsupergirl4359
    @sngsupergirl4359 11 місяців тому

    Would you be willing to help me figure out my coding for my payout system, using Android Studio? If not, it's totally ok. I know it's annoying work, but I'm so lost, I figured it doesn't hurt to ask.

  • @TheInSinging
    @TheInSinging 6 років тому

    Hello Alexander! Thank you for your tutorial. in Row.cs script the interval between each "slot" is 0.75, they move each y-0.25 (please refer to the Rotate() method), but how do you get them to stop exactly on the right place so the interval remains 0.75? For example they stop at: y=-3.5, y= -2.75, .... y= 0.25. y= 1..., if the slot moves by steps of 0.25, how come the slot doesn't stop at for example, y= 1.25, or y=-1.50?? Please explain further :)

  • @crashzzalex9218
    @crashzzalex9218 4 роки тому

    I can use you rows icons for my game??

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      That are not mine. I got it from vecteezy dot com.

    • @crashzzalex9218
      @crashzzalex9218 4 роки тому

      @@AlexanderZotov ok thanks✌

    • @crashzzalex9218
      @crashzzalex9218 4 роки тому

      @M my?

    • @crashzzalex9218
      @crashzzalex9218 4 роки тому

      @M yes is easy if you have time

    • @crashzzalex9218
      @crashzzalex9218 4 роки тому

      @M i have code but i don't want to make a game for you
      Because i have 1 ideea of game
      And I make from him more than 50.000 euro 100%
      Only 3-4script I make
      And I have a very good market strategy ✌

  • @AnimatorUSA
    @AnimatorUSA 6 років тому +1

    nice bro

  • @mrtobi4399
    @mrtobi4399 6 років тому +1

    thanks a lot

  • @beastmasterbg
    @beastmasterbg 3 роки тому

    thank you

  • @surenmelkonyan1240
    @surenmelkonyan1240 4 роки тому

    Can we use your Slot Machine Art in our games ?

  • @ttbrown6103
    @ttbrown6103 4 роки тому

    Hi, anyone knows how much (costs) to develop a mobile games apps?

  • @aqeelalokhandwala3602
    @aqeelalokhandwala3602 5 років тому +1

    The type or namespace name Row could not be found

  • @gamesmunch
    @gamesmunch 6 років тому

    please make a video on paint simple sprite with brush coloring

  • @mixedgammig8845
    @mixedgammig8845 5 років тому

    every thing is working fine but getting stoppedSlot string empty every time .

    • @AlexanderZotov
      @AlexanderZotov  5 років тому

      Maybe some variable misspelled or something like that.

    • @mixedgammig8845
      @mixedgammig8845 5 років тому

      @@AlexanderZotov if (transform.position.y == -27.8f)
      {
      stoppedSlot = "10CLOVER";
      print("10CLOVER");
      }
      else if (transform.position.y == -25.06f)
      {
      stoppedSlot = "10DIAMOND";
      print("%10DIAMOND");
      }
      else if (transform.position.y == -22.32f)
      {
      stoppedSlot = "10HEART";
      print("%10HEART");
      }
      else if (transform.position.y == -19.58f)
      {
      stoppedSlot = "10SPADES"; print("%10SPADES");
      }

    • @mixedgammig8845
      @mixedgammig8845 5 років тому

      print("1st: " + rows[0].stoppedSlot.ToString());
      print("2st: " + rows[0].stoppedSlot.ToString());
      print("3st: " + rows[0].stoppedSlot.ToString());
      print("4st: " + rows[0].stoppedSlot.ToString());
      print("5st: " + rows[0].stoppedSlot.ToString());
      when i print it it just print 1st 2nd .. not the value in rows[0].stoppedSlot

    • @mixedgammig8845
      @mixedgammig8845 5 років тому

      @@AlexanderZotov every time i just receive for one row not for all

  • @TekWar98
    @TekWar98 4 роки тому

    Pretty cool, but could you include the script with the graphic assets? I downloaded the graphics but I really don't want to try typing your script in from the video.

  • @KsiazeTruflii
    @KsiazeTruflii 4 роки тому

    How can I make it in 3D

  • @МихаилБелов-т7т
    @МихаилБелов-т7т 4 роки тому

    Привет! Спасибо за туториал, но возникла маленькая проблемка. Не срабатывает OnMouseDown. Всё делал в точности с уроком, повторял каждое действие, коллайдер стоит на геймобж, стоит галочка, что это триггер, но бесполезно, сколько ни тыкай. Помогите)

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      Может быть триггер срабатывает, а дело совсем в другом.

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      А может быть опечатка в названии метода.

  • @benmurrells7747
    @benmurrells7747 5 років тому +1

    can u link the scripts please

  • @random_precision_software
    @random_precision_software 6 років тому

    Can you do a connect 4 game and rock paper scissors..Please 😜👀😆✨👍😂🎊🎂

  • @kokak9540
    @kokak9540 3 роки тому +1

    I can draw graphic designs but I can't make program 👁💧👄💧👁

  • @гугушка-т5й
    @гугушка-т5й 6 років тому +1

    Класс!

  • @viralkukadiya5008
    @viralkukadiya5008 5 років тому

    Viral Kukadiya
    1 second ago
    hello i have follow your video but i am not seen pool row so please how to make pool row1,row2,and row3

  • @Dom-0017
    @Dom-0017 4 роки тому

    7:34 удивился, что на русском написано "файл, правка, вид"

  • @mopto7833
    @mopto7833 3 роки тому

    Мужик, ну ты же понимаешь, что тут чистый хардкод?
    Если ты захочешь разширять игру, то нужно будет ещё больше хардкодить.
    Но есть один плюс - это единственный туториал

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому

      Это не хардкор :-) это хардбас

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому

      И стартовая площадка

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому

      Никто ж не мешает переосмыслить, улучшить. Согласись-ка? ;-)

    • @AlexanderZotov
      @AlexanderZotov  3 роки тому

      И да, я вас богом Юнити молю, не включайте тут Сакутина ;-)

    • @mopto7833
      @mopto7833 3 роки тому

      @@AlexanderZotov Конечно, но я говорю как есть. Если делать что бы "работало", то без вопросов, а так это пример того как игры делать не желательно

  • @simonkocher9938
    @simonkocher9938 5 років тому +6

    Can you give us the 2 codes? Pls

    • @kylebedell3731
      @kylebedell3731 5 років тому +1

      How did that go?

    • @luchollandsyd
      @luchollandsyd 5 років тому

      @@kylebedell3731 yeah i cant drag the row script and having 2 rotates causing errors

  • @adamprokop
    @adamprokop 3 роки тому

    11:00 Dude, you did not..

  • @piyushrathod001
    @piyushrathod001 4 роки тому

    Hi "OnMouseDown" not working

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      Maybe you forgot to add a collider?

    • @piyushrathod001
      @piyushrathod001 4 роки тому

      @@AlexanderZotov Hi
      Thanks for reply. I have added Box collider 2d in “GameControl” object.

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      So, doesn't it still work?

    • @piyushrathod001
      @piyushrathod001 4 роки тому

      @@AlexanderZotov Collider is set as you describe in video but not work. Even inside function of OnMouseDown is working ok when I use inputkey function.

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      Then a mistake is somewhere else I guess.

  • @dukilica9863
    @dukilica9863 6 років тому

    How you download this and how to add in Unity...bdw tnx for video!

    • @AlexanderZotov
      @AlexanderZotov  6 років тому

      Hope this one can help you ua-cam.com/video/2ZGFYMnQXf8/v-deo.html

  • @ShowStudio97
    @ShowStudio97 3 роки тому

    Make a roulette game buddy

  • @JoTPage
    @JoTPage 4 роки тому +1

    for the huge if statement :
    Dictionary duplicates = new Dictionary();
    for (int i =0; i < rows.Length; ++1)
    {
    string slotValue = rows[i].stoppedSlot;
    if ( duplicates.ContainsKey(slotValue))
    duplicates[slotVallue]++;
    else
    duplicates[slotValue] = 1;
    }
    foreach(KeyValuePair duplicate in duplicates)
    {
    AwardPrizeForSlotsOf(duplicate.Key, duplicate.Value);
    }
    private void AwardPrizeFor3SlotsOf(string slotValue, int duplicateCount)
    {
    switch(slotValue)
    {
    case "Diamond":
    if (duplicateCount == 3)
    prizeValue = 200;
    else if (duplicateCount == 2)
    prizeValue = 100;
    break;
    [...]
    }
    }
    For multiple of 3 :
    Random.Range(20, 34) * 3;
    you'll have the same result, but without the need for a swich over %3.

  • @8978martin
    @8978martin 6 років тому +1

    tutorial super qix game please

  • @aniketcoder1469
    @aniketcoder1469 3 роки тому

    'Row.rowStopped' is inaccessible due to its protection level
    please solve this error please

  • @Mario-xl6ii
    @Mario-xl6ii 5 років тому

    What is wrong?
    private int randomValue;
    private float timeInter;
    public bool RowStopped;
    public string StoppedSlot;
    void Start()
    {
    RowStopped = true;
    GameCon.HandlePulled += StartRot;
    }
    void StartRot()
    {
    StoppedSlot = "";
    StartCoroutine("Rotate");
    }
    private IEnumerator Rotatee()
    {
    RowStopped = false;
    timeInter = 0.025f;
    for (int i = 0; i < 30; i++)
    {
    if (transform.position.y Mathf.RoundToInt(randomValue * 0.5f))
    timeInter = 0.1f;
    if (i > Mathf.RoundToInt(randomValue * 0.75f))
    timeInter = 0.15f;
    if (i > Mathf.RoundToInt(randomValue * 0.95f))
    timeInter = 0.2f;
    yield return new WaitForSeconds(timeInter);
    }
    if (transform.position.y == -3.5f)
    StoppedSlot = "Diamond";
    else if(transform.position.y == -2.75f)
    StoppedSlot = "Crwon";
    else if (transform.position.y == -2f)
    StoppedSlot = "Melon";
    else if (transform.position.y == -1.25f)
    StoppedSlot = "Bar";
    else if (transform.position.y == -0.5f)
    StoppedSlot = "Seven";
    else if (transform.position.y == -0.25)
    StoppedSlot = "Cherry";
    else if (transform.position.y == -1f)
    StoppedSlot = "Lemon";
    else if (transform.position.y == -1.75f)
    StoppedSlot = "Diamond";
    RowStopped = true;
    }
    private void OnDestroy()
    {
    GameCon.HandlePulled -= StartRot;
    }
    }
    ///////////////////////
    public class GameCon : MonoBehaviour
    {
    public static event Action HandlePulled = delegate { };
    [SerializeField]
    public Text prize;
    [SerializeField]
    public Row[] rows;
    [SerializeField]
    public Transform handle;
    public int Prize;
    public bool resultChecked = false;
    private void Update()
    {
    if(!rows[0].RowStopped || !rows[1].RowStopped || !rows[2].RowStopped)
    {
    Prize = 0;
    prize.enabled = false;
    resultChecked = false;
    }
    if(rows[0].RowStopped && rows[1].RowStopped && rows[2].RowStopped && !resultChecked)
    {
    CheckResults();
    prize.enabled = true;
    prize.text = "Prize: " + Prize;
    }
    }
    void OnMousClick()
    {
    if (rows[0].RowStopped && rows[1].RowStopped && rows[2].RowStopped)
    StartCoroutine("Pull");
    }
    private IEnumerator Pull()
    {
    for (int i = 0; i < 15; i += 5)
    {
    handle.Rotate(0f, 0f, i);
    yield return new WaitForSeconds(0.1f);
    }
    HandlePulled();
    for (int i = 0; i < 15; i += 5)
    {
    yield return new WaitForSeconds(0.1f);
    }
    }
    private void CheckResults()
    {
    if (rows[0].StoppedSlot == "Diamond"
    && rows[1].StoppedSlot == "Diamond"
    && rows[2].StoppedSlot == "Diamond")
    Prize = 200;
    else if (rows[0].StoppedSlot == "Crown"
    && rows[1].StoppedSlot == "Crown"
    && rows[2].StoppedSlot == "Crown")
    Prize = 400;
    else if (rows[0].StoppedSlot == "Melon"
    && rows[1].StoppedSlot == "Melon"
    && rows[2].StoppedSlot == "Melon")
    Prize = 400;
    else if (rows[0].StoppedSlot == "Bar"
    && rows[1].StoppedSlot == "Bar"
    && rows[2].StoppedSlot == "Bar")
    Prize = 400;
    else if (rows[0].StoppedSlot == "Seven"
    && rows[1].StoppedSlot == "Seven"
    && rows[2].StoppedSlot == "Seven")
    Prize = 400;
    else if (rows[0].StoppedSlot == "Cherry"
    && rows[1].StoppedSlot == "Cherry"
    && rows[2].StoppedSlot == "Cherry")
    Prize = 400;
    else if (rows[0].StoppedSlot == "Lemon"
    && rows[1].StoppedSlot == "Lemon"
    && rows[2].StoppedSlot == "Lemon")
    Prize = 400;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Diamond"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Diamond"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Diamond")))
    Prize = 300;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Crown"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Crown"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Crown")))
    Prize = 300;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Melon"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Melon"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Melon")))
    Prize = 300;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Bar"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Bar"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Bar")))
    Prize = 300;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Seven"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Seven"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Seven")))
    Prize = 300;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Cherry"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Cherry"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Cherry")))
    Prize = 300;
    else if (((rows[0].StoppedSlot == rows[1].StoppedSlot)
    && (rows[0].StoppedSlot == "Lemon"))
    || ((rows[0].StoppedSlot == rows[2].StoppedSlot)
    && (rows[0].StoppedSlot == "Lemon"))
    || ((rows[1].StoppedSlot == rows[2].StoppedSlot)
    && (rows[1].StoppedSlot == "Lemon")))
    Prize = 300;
    resultChecked = true;
    }
    }

  • @luchollandsyd
    @luchollandsyd 5 років тому

    handle[i].Rotate(0f, 0f, i);

  • @gauravverma3788
    @gauravverma3788 Рік тому

    you can provide source code ..

  • @MelonKR4
    @MelonKR4 4 роки тому

    Код, конечно, адское говно, но урок, наверное, полезен для новичков

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      Ты чё, посланник Сакутина?

    • @MelonKR4
      @MelonKR4 4 роки тому

      @@AlexanderZotov не посланник, но в последнее время зачастил его смотреть, ахах
      Теперь не могу смотреть ролики, где вот такой страшненький код, аж передёргивает
      Хотя, честно говоря, такой эффект у меня был ещё до знакомства с каналом Сакутина (даже от собственного кода)
      Перфекционизм течёт в наших венах, так сказать

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      Идеальный код - это миф.

    • @MelonKR4
      @MelonKR4 4 роки тому

      @@AlexanderZotov идеальный код - миф, но говнокод - вполне себе реальность. Нахрена делать двадцать ифов, если можно управиться с ОДНИМ??? К непостижимому идеалу нужно хотя бы стремиться

    • @AlexanderZotov
      @AlexanderZotov  4 роки тому

      @@MelonKR4 Мне больше непонятна патологическая неприязнь к if у многих "крутых" программистов. Надо просто дышать глубже в случае такого приступа - помогает.

  • @kyriacosflouros7778
    @kyriacosflouros7778 9 місяців тому

    Can anyone sent the scripts in the comments

  • @bimbaca3716
    @bimbaca3716 6 років тому +1

    nicwe

  • @Takamanoharra
    @Takamanoharra 4 роки тому

    it's a good tutorial thx but here
    private void Update ()
    {
    if (!rows[0].rowStopped || !rows[1].rowStopped || !rows[2].rowStopped)
    {
    prizeValue = 0;
    prizeText.enabled = false;
    resultsChecked = false;
    }
    Update have an error "Update can't be call for trame if MonoBehaviour is active"
    2 days i search the problem '-.-,

  • @xus9380
    @xus9380 5 років тому

    I want to play that machine

    • @AlexanderZotov
      @AlexanderZotov  5 років тому +1

      Just do it :-)

    • @xus9380
      @xus9380 5 років тому

      @@AlexanderZotov how do I get it ? 😄

    • @xus9380
      @xus9380 5 років тому

      @@AlexanderZotov can you make a tutorial video how to make slot machine 3×5 with bet and credit