How to create a game in MIT App Inventor 2

00:12:08
https://www.youtube.com/watch?v=4Kau-IbgKfk

概要

TLDRIn this video, the creator demonstrates how to build a simple car game for Android using MIT App Inventor. The tutorial covers the login process to MIT App Inventor, creating a new project, designing the user interface with components like a canvas for the car and labels for the score, and coding the game mechanics using block coding features. Players can increase car speed by clicking, and the game ends when the car touches the edge of the screen. The video also explains how to test and download the app.

収穫

  • 🚗 Increase car speed by clicking on it.
  • 📊 Display score using a label.
  • 🛠️ Use block coding for game logic.
  • 🖼️ Upload images for graphics.
  • 🔄 Restart the game after it ends.
  • 📲 Download APK for Android installation.
  • 🌐 Link for source code provided in the description.
  • 🎮 Create a simple mobile game easily.

タイムライン

  • 00:00:00 - 00:05:00

    The video introduces how to create a simple car game for Android using MIT App Inventor. It begins by explaining how the car's speed increases with each click, which correlates to the player's score.

  • 00:05:00 - 00:12:08

    Following an overview of the setup, the creator guides viewers through designing the game layout, adding components like the car image, score display, and coding the game's mechanics. It concludes with instructions on running the app and building the APK for installation on Android devices.

マインドマップ

ビデオQ&A

  • What is MIT App Inventor?

    MIT App Inventor is a visual programming environment that allows users to create Android apps.

  • What do I need to start creating a game?

    You need to log in to the MIT App Inventor website and create a new project.

  • How do I increase the car speed in the game?

    The car's speed increases whenever the user clicks on the car in the game.

  • How can I test my app?

    You can use an emulator provided by MIT App Inventor or install the app on your Android device.

  • What happens when the car reaches the edge of the screen?

    The game ends, and the final score is displayed.

  • Can I download the created game?

    Yes, you can build the APK file and download it to your Android phone.

  • Where can I find the source code for this game?

    The source code will be provided in the description of the video.

  • How can I restart the game?

    You can restart the game by clicking on the designated restart option.

ビデオをもっと見る

AIを活用したYouTubeの無料動画要約に即アクセス!
字幕
en
オートスクロール:
  • 00:00:00
    you have to stop this car to reach the
  • 00:00:03
    age of your Android phone okay so I'm
  • 00:00:06
    whenever and click again my score
  • 00:00:08
    increase to two and the car speed is
  • 00:00:11
    also increased
  • 00:00:12
    whenever I'm click on three its code is
  • 00:00:14
    three and car speed is increased and if
  • 00:00:18
    I'm going to again click on it click on
  • 00:00:21
    it click on it and you can see the car
  • 00:00:24
    speed is increased very high now and
  • 00:00:26
    whenever just this one is reached eh
  • 00:00:29
    and cam is over and your score is 13
  • 00:00:36
    hi guys this is sorrow in this video I'm
  • 00:00:39
    going to show you how to create a game
  • 00:00:41
    for your Android mobile so in this video
  • 00:00:45
    we will learn how to use MIT App
  • 00:00:47
    Inventor to create a game so let's start
  • 00:00:51
    so here you can see that's MIT App
  • 00:00:55
    Inventor website so first you need to
  • 00:00:57
    login into this website and then you
  • 00:01:00
    have to click on my project and here you
  • 00:01:03
    will see a star new project your project
  • 00:01:06
    name is car and just click on OK
  • 00:01:11
    so here you can see that's the skin here
  • 00:01:13
    fine
  • 00:01:14
    so now I'm going to use urban layout
  • 00:01:17
    that one is horizontal arrangement like
  • 00:01:22
    this and this should be fill parent
  • 00:01:25
    height and whether it's also for parent
  • 00:01:28
    like this no here I'm going to drag and
  • 00:01:31
    drop burn canvas you will find it
  • 00:01:35
    drawing an animation and drag and drop
  • 00:01:38
    this canvas and this should be also fill
  • 00:01:42
    parent and where there's also propellant
  • 00:01:44
    like this no here I'm going to drag and
  • 00:01:47
    drop you made a spirit one like this
  • 00:01:51
    that one is our car ok and no here I'm
  • 00:01:56
    going to use one label to display the
  • 00:02:00
    score ok so here's something level and
  • 00:02:06
    that one is for the score so I'm going
  • 00:02:11
    to use her one more
  • 00:02:13
    lay out like horizontal arrangement
  • 00:02:16
    again like this and this should be here
  • 00:02:21
    and this horizontal should be with is
  • 00:02:25
    will Balint not right okay and here is
  • 00:02:30
    one more level like this fine
  • 00:02:34
    and this level value is zero and first
  • 00:02:38
    level is practice scores like this no
  • 00:02:44
    you can increase font size also font
  • 00:02:48
    like this font size is 20 now here you
  • 00:02:55
    need to find out one image in Google and
  • 00:02:57
    here we are going to use one image of
  • 00:03:00
    God and I already have this one so click
  • 00:03:03
    on this image spirit and you will see
  • 00:03:06
    here picture option click on it and
  • 00:03:08
    click on upload file and click on choose
  • 00:03:11
    file and here you will get move on
  • 00:03:14
    picture and I'm going to open it click
  • 00:03:21
    on okay wait some seconds and you will
  • 00:03:25
    see that's the Academy that one is PNG
  • 00:03:27
    image and I'm going to make it the site
  • 00:03:31
    200 pixels and it is contain 50 pixels
  • 00:03:37
    not this one is not worth so height is
  • 00:03:40
    50 and it is threader's 50 fine this one
  • 00:03:47
    this will work right so that's my career
  • 00:03:49
    and that's my scoreboard
  • 00:03:52
    no we are going to the block structure
  • 00:03:54
    to write some basic code okay that's
  • 00:03:58
    very easy you don't need to worry about
  • 00:04:00
    this at one image displayed whenever is
  • 00:04:03
    someone is touch it like this one
  • 00:04:06
    touched then we will get a nice light
  • 00:04:10
    one variate variable in this lies global
  • 00:04:14
    and their name the value is something
  • 00:04:19
    maths
  • 00:04:20
    and this one is and the value of this is
  • 00:04:27
    speed and this one is one right now
  • 00:04:31
    right and now we create another variable
  • 00:04:36
    so just copy and paste this like this
  • 00:04:41
    and the variable is for this course and
  • 00:04:44
    in the index light score is from zero no
  • 00:04:49
    the thing is whenever we touched this
  • 00:04:53
    car so I'm going to change the name of
  • 00:04:55
    this image image rate and this name is
  • 00:05:00
    something car so we will not get
  • 00:05:03
    confused click on OK and go to the blog
  • 00:05:06
    section here you will see whenever we
  • 00:05:08
    card or touched so you need to set the
  • 00:05:13
    value of x and y position okay now click
  • 00:05:17
    on card and here you will find set car x
  • 00:05:22
    value set car sidecar acts like this and
  • 00:05:30
    the x value is go to the math section
  • 00:05:36
    and we will figure out how we will get
  • 00:05:39
    this value from the rancor and either an
  • 00:05:42
    integer should start from 0 to 20 and
  • 00:05:46
    copy this code and paste it and the Y
  • 00:05:52
    value of this is starting from 1 to 300
  • 00:05:57
    something know the speed of car is now
  • 00:06:03
    they have to define the speed and we
  • 00:06:05
    have to increase the speed also right so
  • 00:06:08
    we are going to set this speed so click
  • 00:06:11
    on car and you will find here is speed
  • 00:06:14
    third and that one is I got it this one
  • 00:06:19
    drag and drop this like here and SP
  • 00:06:24
    speed we needed speed so you have to
  • 00:06:26
    just go your cursor here in high speed
  • 00:06:29
    and caddy value here and drag and drop
  • 00:06:33
    check like here so we will get the speed
  • 00:06:36
    of our car from this variable now the
  • 00:06:38
    speed is only one
  • 00:06:40
    now we have to increase the speed every
  • 00:06:44
    time whenever someone user is touch
  • 00:06:46
    power card so what we will do
  • 00:06:50
    set this global value so drag and drop
  • 00:06:53
    the set speed yes we are going to
  • 00:06:57
    increase the speed so go to the math sir
  • 00:07:00
    maths blog and you will find your plus
  • 00:07:04
    one test one now you have to increase
  • 00:07:08
    the speed so I'm going to get this find
  • 00:07:11
    your copy and paste get over speed and
  • 00:07:14
    increase it by one like this all right
  • 00:07:20
    and now we need to increase the score
  • 00:07:24
    also so copy and paste this whole code
  • 00:07:27
    and you have to just change it to global
  • 00:07:29
    score Global is code and plus one Simba
  • 00:07:33
    know if you have to set the value of our
  • 00:07:38
    if score like here you can see the still
  • 00:07:41
    zero value so we have to say is had this
  • 00:07:43
    level value right so we are going to set
  • 00:07:46
    this value so go to the devil and which
  • 00:07:49
    level is this one is this one level is
  • 00:07:52
    level two so Labour click on level two
  • 00:07:55
    and you have to find out that level two
  • 00:07:58
    dot txt so we have to set this level to
  • 00:08:02
    value something get clover to score this
  • 00:08:09
    is fine no the thing is how this game is
  • 00:08:14
    over
  • 00:08:15
    fine so whenever whenever car is touch
  • 00:08:20
    the edge okay if the car is collapse
  • 00:08:23
    with this line it means age all right so
  • 00:08:28
    this gamble over so when car dot each
  • 00:08:32
    reached then what we will do that labor
  • 00:08:37
    to we have to define this touched oh
  • 00:08:46
    there we need to context and this one is
  • 00:08:51
    something
  • 00:08:53
    game is key over and your score is
  • 00:09:05
    something fine and this one is the level
  • 00:09:10
    burn we have to display this game over
  • 00:09:13
    in the replace office old and D we need
  • 00:09:19
    to define sad global value speed sad
  • 00:09:26
    global speed is going to be one again
  • 00:09:30
    and the score is going to be zero fine
  • 00:09:38
    great so now we are going to run this
  • 00:09:42
    app and how its fur so click on connect
  • 00:09:46
    and I am using your emulator if you
  • 00:09:48
    don't use emulator so you can use the
  • 00:09:51
    Android mobile you need to just act and
  • 00:09:56
    then you have to install MIT App
  • 00:09:59
    Inventor app in your Android phone and
  • 00:10:02
    if scan your code and you can run this
  • 00:10:05
    app in your Android phone also so I am
  • 00:10:08
    using your emulator to display the
  • 00:10:10
    output of this app and you will see this
  • 00:10:15
    well run no I'm going to click on again
  • 00:10:17
    this car this car speed is increased so
  • 00:10:21
    I have to stop this car to reaching the
  • 00:10:24
    edge off my phone I am going to click on
  • 00:10:26
    again click on again and that car speed
  • 00:10:30
    is going to the increase you can see
  • 00:10:32
    here not now the car speed is increased
  • 00:10:36
    one by one one by burn and now if I'm
  • 00:10:39
    going to stop to touch it and you will
  • 00:10:42
    see here my score is tan and now the
  • 00:10:45
    game is over now if you want to restart
  • 00:10:49
    your game so you have to click on again
  • 00:10:51
    but you can see here your restore is 11
  • 00:10:54
    so I had to watch me what should you
  • 00:10:56
    have to do it the mistake is you can see
  • 00:10:58
    here I have done coffee and failed
  • 00:11:01
    that's why the mistake in here
  • 00:11:03
    just change its to global score fine the
  • 00:11:07
    gamma but your score is 50 I'm going to
  • 00:11:10
    just click on this again you will see
  • 00:11:11
    it's code is fun click again again again
  • 00:11:14
    like this so if you want to install this
  • 00:11:18
    game so you need to click on build and
  • 00:11:20
    you will see here ad provide QR code for
  • 00:11:23
    apk file so that's your apk file you can
  • 00:11:25
    install this unit in your Android phone
  • 00:11:28
    so just click on this ok it's takes them
  • 00:11:31
    more time to process so it's just scan
  • 00:11:34
    this code and download this app in your
  • 00:11:36
    mobile phone so that's very simple if
  • 00:11:39
    you want to download this game and if
  • 00:11:41
    you want this e IFI and if you don't
  • 00:11:45
    want to code this so you can download
  • 00:11:47
    this code of this app from a website I
  • 00:11:51
    will give you the link of link in the
  • 00:11:53
    description you can download it thank
  • 00:11:56
    you so much for watching this video
  • 00:11:57
    please like my video subscribe my
  • 00:11:58
    channel and if you have any doubt you
  • 00:12:01
    can ask me on comment thank you have a
  • 00:12:02
    nice day
  • 00:12:03
    [Music]
タグ
  • MIT App Inventor
  • Android game
  • coding tutorial
  • game mechanics
  • car game
  • app development
  • block coding
  • tutorial
  • mobile app
  • game design