Part 5: The Play State - Make Video Games w/ LibGDX: Flappy Bird
Vložit
- čas přidán 25. 06. 2024
- Making Flappy Birds from start to finish using Java and the LibGDX Framework. The result being a game that runs on multi-platforms including: Android, iOS, Desktop, and Blackberry!
Learn about game-loops, textures, orthographic cameras, and game worlds!
Please feel free to ask questions, I am always willing to help when needed!
If you are feeling generous please help by donating to my patreon page... This helps me spend more time producing content that I otherwise wouldn't be able to:
/ brentaureli
source: github.com/BrentAureli/Flappy... - Věda a technologie
Best explanations I've seen in a LibGdx tutorials.Nice work!
you've explained every "core" methods of LibGDX very carefully, so easy to understand
thank you so much!
I've been immediately hooked on this series since making some time to finally watch it after seeing it on androiddev subreddit. I've already subscribed on the second video, but you've really attracted me as a great CZcamsr as you gracefully accepted a trivial (yet greatly appreciated) suggestion to meet Java conventions with your lower case package names. I know that's the smallest issue, but combined with your great explanations and perfectly portioned videos, you've really impressed me and I look forward to seeing more of your content! Thanks Brent!
Best explanations I've seen in a LibGdx tutorials indeed!!!!
you structured the game realy well i love the way its uses java and opps concepts
You are really good in game development!
Thank you
Thanks for your lessons.
I'm waiting for more videos!!
Great videos, thank you very much!
We need more tutorials!! We are hungry :Q__
Thanks for all what you are doing here!
Nice tutorial, thanks.
Thank you Brent :))))
you videos are the best
Keep making videos like this and you will blow. honestly. Its inevitable. Well done.
Random Tutorials yeah
I added "Well done" so you could of guessed that in this context blow up meant good. But yeah I think if you continue with these type of videos and the production value you have you will grow a lot.
+Brent Aureli Hahah. You're doing well indeed. Keep it up.
excellent!
winter is coming brent
amazing
+Brent Aureli first of all, thank you very much your tutorial series we love that sooo much!
I have a quick question about camera zoom settings:
Why do we need this?
Do we need this only if our units needs some zoom, or there are some other reasons too?
If I leave this settings, is my game will works the same way like I set up this?
(Aside from the units width's and height's seems like the half of the original images on the display.)
+Brent Aureli
I did not have the exact wording, I meant this line settings parameters:
camera.setToOrtho(false, WindowScreen.WIDTH / 2, WindowScreen.HEIGHT / 2);
My problem is the images resolution are too low if I halved the world screen.
Can I just set the parameters without '/ 2' or do I must use like this to avoid the later screen-match problems?
Thank you for your reply and sorry my english is not that good. :|
Why did you stopped uploading man, your videos are awsome!
Is that the gsm.render(batch); in FlappyDemo directly calls the method in menustate
Also another question...
How the update method in playstate be called?
Instead of "zooming" the camera into the texture, how do I make the texture bigger? I find that zooming into it loses its image quality a bit.
Hello I'm pretty new to android but I have made a couple iOS games with spritekit, however with spritekit I didn't use a camera, I simply just moved the background image and repeated it to simulate a movement, and the same with the obstacles, move and remove. Is the camera the only option with LibGdx?
Shit my version of android doesn't have the 'refactor' only button, it goes to rename then mentions if i would like to apply to all folders and that it can't change directories in libraries or something...
Will this method be ok for supporting several screen ratios (like for example if someone had a slightly wider and shorter mobile screen) or would that stretch the images with this code? thanks for any answers in advance
same problem and need help too , if you have the answer please tell me , thanks
What should we do to display that program in Android as well?
Sry can u give me more explanation on the GSM, great work btw
+Brent Aureli How do I get my image to match the game background, it's drawing to the screen with a white background. I noticed the bird image got a white background too.
*****
I changed how the image looked in your bird file
What if I only intend the PlayState to be called only after touching the playbutton and not the entire screen?Plz help.
I am using this video for a different game but I have everything working. When I run I see the clear color I have set so I know I am on the right screen. But when I click nothing happens. I even put System.out.println("hello") to see if it was responding to clicks. Nothing in terminal.
If you click on MenuState and the screen disappears,
Render on PlayState sb.end (); I did not put in. See my experience :)
What is the code that if the user just touched on the play button and not the screen
i did all you you said, but my playbutton doesnt responds. it is just in its normal state not going to play state
Hi Brent firstly thank you very much for your all useful courses and efforts : ) . I have got menustate, playstate and a gameoverstate. I want to push gameoverstate onto playstate and view both of them at the same time. But gameoverstate is coming with its sb and playstate does not appear. I tried Gdx.gl.glClearColor( 0, 0, 0, 0 ); but it didn't work. sorry my bad en. please help : )
I understand. Thank you
Like for: Basics first!
my game keeps on automatically clicking for me. I don't know if it is an onclick listener problem or the handleinput problem. Somebody plz help!
Please help me Brent, when i try to rename the "States" to "state" it appear the following "Package 'States' contains directories in libraries which cannot be renamed. Do you want to rename current directory or all directories in project?" and after that it appears some problems which i cant do anything, and it does not changes the name...
In my flappy Demo the Menu does not appear, instead it goes to the red screen with the bird... I think its because of the problem above, please help me!
Youre awsome!
+delgamer377 well I did: right mouse click on "States" then clicked "Show in Explorer". you will see the map and you need to rename that map, that should work. But then I had problems with the "dispose" I couldn't generate that. So I turned the map "states" back to "States" and everything worked. I don't know why we should rename it tho.
what have you done by now ? have you solved the problem? Did you reached the other tutorials? LET ME KNOW asap !!
Thank you!!
Package 'States' contains directories in libraries which cannot be renamed. Do you want to rename current directory or all directories in project?
+Fayzur Almas yes
Hey, why are you using your own States and not the gdx Class "Screen" ?
+Marvin Jansen did you watch the video?
Hey Brent, I have a problem renaming my package. First there was a warning saying "Package 'States' contains directories in libraries which cannot be renamed. Do you want to rename current directory or all directories in project?". I have the option to "rename current", "rename all" and "cancel. I've tried both current and all but all I get is a conflict error saying that I cannot create the .java files as they already exist.
+Brent Aureli Having the same problem
+DawnfallGames +Brent Aureli me too
+Raging Hotdog I had the same problem. I got it to work by clicking "preview" instead of "refactor" in the dialogue box. Then I continued from there and it worked. I don't know why it didn't work by just clicking "refactor". Maybe just a bug. I'm new-ish to Java and Android studio, but it seems confusing that it would say the directories contain libraries, when you just have to import libraries. I feel like it shouldn't matter.
+delgamer377 +Raging Hotdog I had the same problem. I got it to work by clicking "preview" instead of "refactor" in the dialogue box. Then I continued from there and it worked. I don't know why it didn't work by just clicking "refactor". Maybe just a bug. I'm new-ish to Java and Android studio, but it seems confusing that it would say the directories contain libraries, when you just have to import libraries. I feel like it shouldn't matter.
where the hell is "preview" in the dialogue box
can you please tell us What is the code that if the user just touched on the play button and not the screen to start it
+ebad ahmed It happened to me. I had forgotten to implement the update method of MenuState class.
@Override
public void update (float dt) {
handleInput ();
}
when i click on my app in the play button it shows a black screen .. but why the red background and the bird dont show ??
+Shuvo Opu It happened to me. I had forgotten to implement the update method of MenuState class.
@Override
public void update (float dt) {
handleInput ();
}
Help, when I type "cam" then I get an error says : "Cannot resolve symbol 'cam'".
am I miss something? I already follow your step like this video, but I still get an error.
Thanks for this tutorial man! Subscribed! :)
Solved..I just know what make my code get an error, I rename 'cam' variable to my own variable. Hahaha
Very nice tutorial series! As a side note, I actually did not realize that the camera had an option to make Y count up as you go down the screen (I am very new to LibGDX). I would highly suggest to anyone to set 0, 0 to be in the upper-left hand corner. That is because this is traditionally where it is in most other game frameworks and platforms (in fact, LibGDX is the only one I have ever seen to place it in the lower-left hand corner by default). So if you ever need to look up help to a question or want to look at other people's code for other frameworks, you won't have to be converting everything in your head or your code to be an origin in the lower-left. It is kind of nice to have it match the Cartesian coordinate system, but it just isn't a common practice in game development.
+Brent Aureli
can you ansr.me.plz
when i click playBtn the background becom BLACK and the bird did't show !!!
Hello there,
I have a problem, my program doesn't seem to call my "update()" method at any time, so the button never works.
Can anyone help me ?
Remove comment slashs from file State.java
couldn't you just scale the image up when you draw it into the world? instead of changing the viewport
i have a problem when i clik playBtn the background become Black!!!! and the bird didn't show
plz help !!
in gamestatemanager in "set" methode,
public void set(State state){
state.pop();
state.push(state);
}
pop then push
I had the same problem. In the handleInput() method of the MenuState class, I had put dispose() outside of the if statement (and it needs to be inside the if statement).
thanks! that work it!
you put a button but not used just a texture
When I click the screen and transition into playState my texture is black. Why is this?
Me too did uou solv it?? plz ansr me !!!
+Islem Djarallah
in gamestatemanager in "set" methode,
public void set(State state){
state.pop();
state.push(state);
}
pop then push
I'm using my phone to emulate the app and so far it does so horizontally :( I've tried switching the height and width values and even their place in the code but it's still horizontal somebody pls help :c
Skip to the final video of the series and watch the first minute or so..
+Joseph Harris I gave up :p I'll try something else :)
Go to AndroidManifest.xml and update the activity sreenOrientation line to Landscape to portrait ( android:screenOrientation="portrait")
+Saravana Raja I got this! Thanks for your help stack overflow is godly. do you know how to ad admobs with firebase? I've tried several hundred million times to no avail I'm starting to think it's impossible :p
That's good u got the solution. Sorry ryan i'm new to fire base.
dio cancaro
A few seconds ahead the video starts to blur & makes it barley impossible to see !!!!!!!!!!!
Sounds like a internet issue, its not the video.