Creating Mobile Controls on Scratch

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

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

  • @floppathejetskider
    @floppathejetskider 9 месяцев назад +10

    It works and it’s perfectly smooth, 10/10!

  • @Antarctica_ice
    @Antarctica_ice 10 месяцев назад +13

    Just put this code:
    When this Sprite (Arrow Button On Mobile) Clicked
    Broadcast [ (Left Or Right Message) ]
    For the Character:
    If i received Broadcast [ (The lastest Message) ]
    And put some Motion blocks that countain moves!

    • @MateusLord
      @MateusLord 9 месяцев назад +1

      E se eu quiser que ele fique em loop, até eu soltar?

    • @NotAlphaSlayer15
      @NotAlphaSlayer15 7 месяцев назад +3

      @@MateusLord*use*
      *if touching mouse pointer and mouse down?*

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

      @@NotAlphaSlayer15 obrigado

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

      Yes but it will only move the num of steps that you have added to the character and no matter how long it is pressed and has to be pressed again and again to move multiple steps (clicks*num of steps in motion block)

    • @ceylqq
      @ceylqq 5 часов назад

      @@adarshpradeepmaurya1320Have you heard of gliding

  • @NotAlphaSlayer15
    @NotAlphaSlayer15 9 месяцев назад +4

    *use for jump*
    *If then Key up arrow pressed or mouse down?*
    *change y by (y speed) or (number)*

    • @shaunaksivaraman3427
      @shaunaksivaraman3427 2 месяца назад +1

      But this means that when you press the arrow keys it auto-jumps.

    • @NotAlphaSlayer15
      @NotAlphaSlayer15 2 месяца назад +1

      @@shaunaksivaraman3427 *“y speed” is a var*

  • @MossManOG
    @MossManOG 6 месяцев назад +4

    It works very well! I had to make my game mobile friendly before a school project, and this was very quick and easy to do.

  • @Foltyn_Fan123
    @Foltyn_Fan123 26 дней назад +2

    Thanks it worked!

  • @Blue_skiesGacha
    @Blue_skiesGacha 10 месяцев назад +4

    This is really smooth! Ty!

  • @Johnlafun4-hr9xb
    @Johnlafun4-hr9xb 3 месяца назад +2

    Thank you, I didn’t know that it needed the ‘mouse down’ block. Because if you don’t use that block, the scratch cat just goes in that direction forever. Thank you for the tutorial!

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

    You are a life saver I need it this for my first scratch game

    • @how-to-scratch
      @how-to-scratch  7 месяцев назад

      Thank you!! I am glad it helped :D

  • @Nokolos
    @Nokolos 2 месяца назад +1

    omg u are so helpful! Tysm!

  • @luigigamingsm
    @luigigamingsm 4 месяца назад +2

    Maybe you should add a platform so that you can program the sprite to go to the ground after clicking the jump button

  • @Freexspirit_442
    @Freexspirit_442 Месяц назад +1

    TYSMM i didnt really thout it would work tho 😅 TYSMMMMMMMMM

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

    I'm making a platformer so this help me a lot

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

    Love your videos am Wolfgang355 Remember me from scratch

  • @nutobrewe_banana
    @nutobrewe_banana 11 месяцев назад +1

    I managed! but when the sprite left and right buttons are hidden and if I click in the same place where they are, the code will work! what's the matter? how to remove?

    • @how-to-scratch
      @how-to-scratch  11 месяцев назад

      Huh, weird! That should not be possible. Make sure that they are hidden with the "hide" block, and if that fails, I would try to temporarily relocate the buttons to the edge of the screen until no longer hidden:
      if hidden:
      go to: -999,-999
      else:
      go to: (position for when not hidden)
      And yo u can check for if hidden however you want to.

    • @nutobrewe_banana
      @nutobrewe_banana 11 месяцев назад +1

      @@how-to-scratch very thanks!

    • @how-to-scratch
      @how-to-scratch  11 месяцев назад

      @@nutobrewe_banana Of course!

  • @Paddingtonthefriend
    @Paddingtonthefriend Месяц назад +1

    Is there may way to make it so two things can go like left and jump?

    • @how-to-scratch
      @how-to-scratch  28 дней назад

      Wdym?

    • @Paddingtonthefriend
      @Paddingtonthefriend 27 дней назад

      So can you move left and at the same time jump

    • @ozlemozlem6760
      @ozlemozlem6760 21 день назад

      @@Paddingtonthefriend that's the problem i can not do. when its walking you can't press jump at the same time on mobile. you just walk.

    • @Paddingtonthefriend
      @Paddingtonthefriend 20 дней назад

      Dang it

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

    You can do it with the move () steps too.

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

    how could i insert the when i receive jump into an if key pressed box

    • @how-to-scratch
      @how-to-scratch  Год назад

      What if you did, When I receive jump > if key pressed?

  • @SlightlyOffendedKiwi
    @SlightlyOffendedKiwi 3 месяца назад +1

    Hey, this might be kind of a complicated question.. but I’m making a game that is both mobile and PC compatible. It’s easy to code in the whole “if clicking right arrow move right” thing and it’s easy to put in the little arrows + jump for mobile.
    For context, at the beginning of the game it asks “are you on mobile or PC” to which it sends the signal of whatever the player clicks, BUT there are multiple places on the map you have to travel to, and when it opens a new backdrop, it HAS to send the signal to get mobile controls regardless of what the player selected because I don’t know how to make it consistently check if the player is/selected mobile.
    Is there a way I can code it in so when the player selects that, it’s possible to check, especially since both “When background switches to” and “when I recieve (signal)” are top blocks, therefore can’t be stacked together.
    Is this too complicated?? Let me know if you have any other questions. Thanks !!

    • @how-to-scratch
      @how-to-scratch  3 месяца назад

      @@SlightlyOffendedKiwi hi! Let me see if this is correct.
      When you initially select mobile, what if you set a variable you could call mobile to true, then throughout the project have an if statement that checks if mobile = true and if so shows the controls?
      If I misunderstood please let me know!

    • @SlightlyOffendedKiwi
      @SlightlyOffendedKiwi 3 месяца назад +1

      @@how-to-scratch hey that might work!
      If I understand you right, I should make a variable titled ‘mobile’ and when the player selects said variable, I put a statement saying “if mobile = true then show controls”?
      Let me run the code for that

    • @how-to-scratch
      @how-to-scratch  3 месяца назад

      @@SlightlyOffendedKiwi essentially yes! Rather, when the player selects the option for mobile (whatever button they select mobile with) then it sets the variable mobile to true

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

      @@how-to-scratch it worked! Thank you so much!!

  • @iamrafi1092
    @iamrafi1092 3 месяца назад +1

    Please make a tutorial about how to make a shoot button for mobile

  • @LAni-Hamliton
    @LAni-Hamliton Месяц назад +2

    my problem is that the button sprits move when touched on screen how to stop them from moving by touching ?

    • @how-to-scratch
      @how-to-scratch  Месяц назад +1

      I think you are putting the motion blocks inside of the button sprite when you should be putting it inside your character sprite. That will cause the buttons to move. Your motion blocks should be inside the player, and should be called by the broadcast that is in the buttons.

    • @pigggy96
      @pigggy96 20 дней назад

      u might be playing it in the mini player mode. so click on the fullscreen button then play it

  • @voltagegaming610
    @voltagegaming610 3 месяца назад +1

    Can we created an Project like you with phone with make Contorller

  • @vitinhogames3207
    @vitinhogames3207 6 месяцев назад +2

    How to press jump and walk at the same time, mine doesn't work, can do it at one time.

    • @how-to-scratch
      @how-to-scratch  6 месяцев назад

      Make sure the events in the player where the player walks and jumps are not in the same chunk of script.

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

      Ohhhh so is mean we can't do it cuz of script?

  • @LUCIANOPEREZ-z9y
    @LUCIANOPEREZ-z9y 8 месяцев назад +1

    Cool

  • @GroundFIsher
    @GroundFIsher 9 месяцев назад +1

    What if I have animations in a sprite when it walks? It's really glitchy

    • @how-to-scratch
      @how-to-scratch  9 месяцев назад +1

      You are absolutely right! Create a separate loop for the animation. You could do:
      When flag is clicked:
      Forever:
      If Touching and Mouse Down?:
      Switch Costume to
      Wait 0.15
      Switch Costume to

  • @Exinciti
    @Exinciti 2 года назад +7

    Also could you make a how to add gravity tutorial?

    • @how-to-scratch
      @how-to-scratch  2 года назад +1

      Hey! You can find information on gravity here! ruclips.net/video/KAPg6yXVjt4/видео.html

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

      @@how-to-scratch thanks

    • @how-to-scratch
      @how-to-scratch  2 года назад +1

      @@Exinciti No problem.

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

      when green flag clicked
      forever
      change y by (Gravity)
      change [Gravity] by (-1)

  • @lizzyr.i.p2203
    @lizzyr.i.p2203 7 месяцев назад +1

    Hello how can I make it so that the character can move around a 2d map with the mobile controls (scrolling camera basically). Because I’ve been having trouble to find how to do it. And if there’s anything you don’t understand then let me know :D

    • @how-to-scratch
      @how-to-scratch  7 месяцев назад

      If it’s for a scrolling platformer, here is a video that would help with that:
      Creating Your First Scrolling Platformer on Scratch - LEARN HOW!
      ruclips.net/video/02ES7e7HHmI/видео.html
      You could implement the button controls with the video by using broadcasts to tell the level when to move.

    • @lizzyr.i.p2203
      @lizzyr.i.p2203 7 месяцев назад +1

      Thank you, but I’ve been trying to do the code and it still doesn’t work. Can you give me the code so I can make it when I click the mobile button the camera scroll moves aswell? And also sorry if I’m bugging you or anything.

    • @how-to-scratch
      @how-to-scratch  7 месяцев назад

      @@lizzyr.i.p2203 I will need to view the actual project and code itself so I can see how you are working with it so far. Would you be able to share it with me?

  • @farhanzifaan3184
    @farhanzifaan3184 5 месяцев назад +1

    Can you tell me when i turn left the chracter also turn left plz tell me

    • @how-to-scratch
      @how-to-scratch  5 месяцев назад

      Make sure you have this:
      When Green Flag Clicked: Set Rotation Style

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

      @@how-to-scratch thanks for give idea

  • @asmaabdulhakim
    @asmaabdulhakim 10 месяцев назад +1

    does this help when we use touch screen also?

  • @melonstuff9creative
    @melonstuff9creative 8 месяцев назад +1

    oh my freaking god it works thank you!!

  • @PhiliponBauvart-on8rl
    @PhiliponBauvart-on8rl 10 месяцев назад +1

    Thank you for your video you are the best

  • @andrejbreininger8889
    @andrejbreininger8889 11 месяцев назад +1

    How can do that walk and jump both work when I press them both

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

      thats the answer i have been looking for

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

    It work but in the platformer it goes through the platform i just dont understand

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

    broadcast is a easier way for me but this is better

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

      Thanks bro 😎

  • @YaniGamingPlayz
    @YaniGamingPlayz 4 дня назад +1

    will it only show up on mobile or what?

    • @how-to-scratch
      @how-to-scratch  3 дня назад

      No, it will show up on every device. I would add a screen that asks what device you’re on (mobile or pc) and if mobile, show the mobile buttons, else, hide

  • @ronjharedrobles2960
    @ronjharedrobles2960 10 месяцев назад +1

    hiim from 2024 of january im 2 day old de, i think u should use ,when this sprite is click, if "not-mousedown" then, brodcast message 1(for arrows),when i receive "message 1", repeat 10 change x by 10

  • @Corn-fe9mz
    @Corn-fe9mz 26 дней назад +2

    How do you do this in mobile if mobile don't got a mouse💀

    • @how-to-scratch
      @how-to-scratch  25 дней назад +1

      While mobile doesn’t have a mouse, it still has a mouse pointer in scratch which is just where your finger is touching in the screen.

  • @andreiasilva8382
    @andreiasilva8382 Месяц назад +1

    Every thing is working but when my character jump he just teleport for up and after he teleport for down can you help me?😅

    • @andreiasilva8382
      @andreiasilva8382 Месяц назад +1

      (Note:sorry by my bad english or englhis? Is because im from brazil and i can prove that because my name and encause this:eu falo portugues br e antes que você pergunte:no portuguese from portugal is diferent from portuguese from brazil)

    • @andreiasilva8382
      @andreiasilva8382 Месяц назад +1

      "Because"

    • @andreiasilva8382
      @andreiasilva8382 Месяц назад +1

      "Everything"and again sorry by my bad englhish or english😢😢

    • @how-to-scratch
      @how-to-scratch  Месяц назад

      Your English is well! Could you share the project with me so I can check out your code and figure out the problem?

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

      Uhh how did i can make this because i dont know how to share a scratch project on the the android?

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

    Thx

  • @RayTheLetterR321
    @RayTheLetterR321 Месяц назад +2

    It's been so long since i have used scratch i that i forgot about the broadcast button 💀

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

    nice

  • @differentsmile6398
    @differentsmile6398 11 месяцев назад +1

    I make maze for mobile but i try making like this mobile control but the cat going in maze wall 🧱 so what solution

    • @how-to-scratch
      @how-to-scratch  11 месяцев назад

      Try following this maze tutorial here: ruclips.net/video/TTEsHhaejZ8/видео.html
      Implement the mobile controls with the collision detection and see if that works!

    • @how-to-scratch
      @how-to-scratch  11 месяцев назад

      If you get stuck along the way, feel free to share and send the project here, and I can help with the code if you would want!

  • @RodimusPrime-1.0
    @RodimusPrime-1.0 2 месяца назад +1

    Bruh i just spam jump button and my player just stuck in the air. How to fix that? 😭

    • @how-to-scratch
      @how-to-scratch  2 месяца назад +1

      It is because of the jumping method I used in my script, which was purely for the tutorial. You will have to define your own jump physics possibly, or in your player sprite, use and if to only jump when your y is at the ground y position, since my script doesn’t account for physics

    • @RodimusPrime-1.0
      @RodimusPrime-1.0 2 месяца назад +1

      @@how-to-scratch ohkk thanks man ❤️

    • @AdrianDalyellMakesAnime
      @AdrianDalyellMakesAnime Месяц назад +1

      At the end of the script put a [wait (0.37) seconds]

  • @nathanc6443
    @nathanc6443 8 месяцев назад +1

    So how to touch 2 places at once

    • @how-to-scratch
      @how-to-scratch  8 месяцев назад

      Could you give an example of what you mean please? :D

    • @nathanc6443
      @nathanc6443 8 месяцев назад

      @@how-to-scratch i want to go right but jump at the same time but im not sure if that would work

    • @nathanc6443
      @nathanc6443 8 месяцев назад

      @@how-to-scratch like in my platformer i tried adding mobile controls but what happened was it didn’t work as well because you cant jump and go right at the same time

  • @Owens-shorts
    @Owens-shorts 29 дней назад +1

    What if your in mobile tho?

    • @how-to-scratch
      @how-to-scratch  28 дней назад

      Not sure what you mean.

    • @Owens-shorts
      @Owens-shorts 28 дней назад

      I found the solution already​@@how-to-scratch

  • @differentsmile6398
    @differentsmile6398 11 месяцев назад +2

    And not maze wall detection

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

    But yeah it’s smooth

  • @Bobby_Unstoppable977
    @Bobby_Unstoppable977 11 месяцев назад +1

    Thankyou

  • @mrcet-i600
    @mrcet-i600 3 месяца назад +1

    Change x by -10 is Not working 😭

    • @how-to-scratch
      @how-to-scratch  3 месяца назад

      Noooo that’s not good

    • @mrcet-i600
      @mrcet-i600 3 месяца назад +1

      Change x by -10 does the same thing as moveright can you please fix it

    • @mrcet-i600
      @mrcet-i600 3 месяца назад +1

      Okay i found Out this is works is by making move left by (Move -10 steps!)

  • @AhmetGocmen-j2p
    @AhmetGocmen-j2p Год назад +1

    O have question for you?

    • @how-to-scratch
      @how-to-scratch  Год назад

      Let me know your question and I’ll do my best to answer!

  • @Kyle-k5y
    @Kyle-k5y 6 месяцев назад +1

    It works

  • @Axochata
    @Axochata 6 месяцев назад +1

    When I receive button doesn’t exist

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

    Make scratch cat face the direction of the button when pressed like me

    • @how-to-scratch
      @how-to-scratch  7 месяцев назад

      Ah! To do that, do this:
      When Green Flag Pressed:
      Set Rotation Style
      Then for each button, when pressed on the left button:
      Point in direction: -90
      For right button:
      Point in direction : 90

  • @Why_why7352
    @Why_why7352 10 месяцев назад +1

    5:09

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

    Open Scratch But On Mobile

  • @r100iscool
    @r100iscool 3 месяца назад +1

    Pls no click [. ] Button

  • @MusaAslam-on8ej
    @MusaAslam-on8ej Год назад +15

    It didnt work

    • @how-to-scratch
      @how-to-scratch  Год назад +4

      I'd love to take a look at your code and see what the issue might be! Would you be able to send me the link to the project, and then I could possibly help you with it?

    • @LVXD-og7iw
      @LVXD-og7iw 11 месяцев назад +5

      ​@@how-to-scratchit didnt work because you only can press ONE button at the same in a phone, because scratch uses "the pointer" to touch a button, and "the pointer" is 1, no 2 or more

    • @LVXD-og7iw
      @LVXD-og7iw 11 месяцев назад +4

      ​@@how-to-scratchThis is the reason because is imposible

    • @America_flag24
      @America_flag24 9 месяцев назад +1

      @@LVXD-og7iwYou forgot to send the link of the project.

    • @Ligmaballssussybaka
      @Ligmaballssussybaka 9 месяцев назад

      ​@@how-to-scratchthats literally my ideas on mobile

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

    the quality is so bad

    • @how-to-scratch
      @how-to-scratch  Год назад +3

      On the video?

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

      yeah

    • @how-to-scratch
      @how-to-scratch  Год назад +1

      @@superyousif That's odd. It shouldn't be bad because the highest quality it goes to is 1080p60FPS.

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

      ​@how-to-scratch nahh bro the quality is amazing 👌

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

      @@barryiscool for real broo

  • @IshanthiSenevirathna
    @IshanthiSenevirathna 3 месяца назад +1

    It didn't work