How to Build a Basic Android Game :Trick To Developed..
So the trick to
Android development is to choose the right tools for
the job and to learn only the skills you really need to build the kind of app
that you want to make I believe that the best tool for Android game development
is unity it makes the whole process so much quicker and simpler so much so that
in this video I'm going to show you how you can get something up and running in
just seven minutes so unity is a game engine that means it handles things like
the physics and controls it provides certain assets
for you ready-made it basically makes the whole process of creating a game much
simpler so you can focus on what makes the game unique and on the assets and on
the design and that unity handle of the more advanced code you only need very
little code to get started with unity and what you do use you can find tons of
guides and references online to help you through that said unity is still very
powerful very flexible and C used by a lot of professional developers in fact
many of your favorite games from the Play Store were probably built using unity
way to try and make a game in Android studio you need to learn Java you need to
understand classes and libraries you need to create the physics engine yourself
so you're handling things like gravity and collision whereas unity does all
that for you makes it so much easier while still being as powerful as you could
need even as a professional developer if you're someone would like to create an
android game but you think maybe it's to difficult it involves too much code
then I hope this videos gonna demonstrate just how quick and simple and easy
the whole process can be I'm gonna really run through it though so if you want
to slow things down and understand what each step does then follow the link in the
description down below as you'll see though the process really is very simple you
don't need any prior knowledge and as long as you've got unity and the Android
SDK installed on your computer already then you'll be good to go okay so seven
minutes let's go so the first thing you want in any game is probably play a character
so you're gonna open up paint or whatever I mean obviously there's better tools
to use for this foot this is all about the morality an the easiest and quickest
player character to make is a square with a face full of attitude this guy you're
gonna take squarey and you're gonna drop him into your game like that so he's a
sprite we also need some platforms for him to walk on so drag your platform
into your game in the exact same way cool thing is look you can drag and
reshape this so if you copy that and then paste it you can make as many as you
want to select your player character squarey and then you're gonna open up here
on the right the inspector and in the inspector you're gonna say add component
physics 2d Rigid body 2d so this is basically 2d physics for your character and
what we're gonna do is we're going to drag the camera onto square e like so in
the hierarchy these along the top here are controls that you can use to decide
what you want to do with your game objects and that one's used for moving stuff
around if we place it right on top of square e then it kind of makes more sense
cuz you can click play and now he's in the center of the screen so anything
that's a child of anything else will follow that thing around anyways enough
talk work okay so select square e the problem you can obviously see here is
he's falling through the ground so we want to add another component and this
time we're going to add physics 2d box Collider 2d I'm gonna do the same thing
with the platform here add component physics 2d box Collider 2d once more and
if we copy these now then we'll also be copying over that new Collider and the
new physics okay so now click Play and hey that's starting to look more promising
okay now the next thing we're going to do is create our first script so that we
can actually start controlling what happens in this game but don't worry it's
very easy so first of all go down to your assets folder in the project window
here and you're gonna right-click anywhere and say create folder script now
with that open right click and say create c-sharp script and we're going to call
this player controls double-click on
that and it should open up the visual studio for you here alright and this is
your first script you'll see there's already some code here I'm going to
reference here because I'm not no mister remember however I did write the
reference so it doesn't feel like cheating alright so what we're doing up here
is we're going to create a new object of the type rigid body 2d like I say
don't worry too much about this you can learn as you go it's gonna be that same
rigid body that is attached to our player character so in order to move our
character all we need to do is say RB which is the new rigid body which refers
to the rigid body attached to our player velocity equals new vector2 and that's
a point that has two axes and we're going to say one that seems like a decent
speed to start off with and then RB velocity y okay so now open back up unity
click on your player like that and then go to add component just as you did before
and this time we're gonna say scripts and then there you have it you have your
player control script that you made a click play we should speed along well
speed along is a strong word but yet is he's certainly moving make that three
and then move three times as quickly yeah that's challenging we want to open up
our script again okay and then we're gonna say during our method if input get
mouse button down the index is zero then against ARB philosophy will why they
probably feel awfully equals new vector2 are the velocity X and then we'll make
that three so the player clicks the mouse whilst the game is running then he should
move upwards now we I know you're thinking you're saying Adam there isn't a
mouse click on Android but that's the cool thing because a mouse click is equivalent
to tapping anywhere on the screen bear with me we're just going to type out
some variables and you don't need to worry about what these mean I will explain it all as we go on ground so
our Boolean are true or false statement equals physics 2d overlap circle ground
check dot position Ground check radius what is ground I'm going to add one more
thing here which is and on ground now we're going to create a new empty game object
and we're gonna call that check around and this is an invisible object that
we're gonna use to see if there's an overlap to see whether or not we're hovering
over the ground of course we want it to move as square emu so just like the
camera I'm gonna drop it underneath square e so that it becomes a child and now
for clicks query you should see that's in the script we have some new options
and the ground check is a transform and take a check ground and drop it in to
ground check then I set the radius to 0.1 we want it to be nice and small and
then now we're gonna create our new layer mask so select your platform and up
here in the inspector you can see it has the option for layer and you're gonna
go add layer and then you're gonna make this layer called ground if you click
back to the inspector you can now select ground as your layer okay so now go
back to your player and then the last public variable what is ground you're
gonna set that to your new layer as ground now fingers crossed it should work
unless we've forgotten something something's on the ground you can click and
he'll jump when he's not on the ground he doesn't jump there you go and that is
the basis of a fun little game and if you follow my advice at the start this video
and you went through the installation process and set up unity and the Android
SDK you should now be able to test your game on your Android phone and it's
quite a great feeling when you see it come to life on your device ok so it's
something pretty basic but it's a great foundation to build upon and there's
not that much more code necessary for handling things like enemies collectables
next levels and tilt controls once you've done that you can just focus on
designing your different graphics and dragging them dropping them into the
scene so you found this useful and Interesting guys if you did then please leave
a like if you'd like to see more like this hit the bell button if you want
notifications comment down below if you have any questions and of course check
out and rule 40 calm for your source for
all things Android

Comments
Post a Comment