Java Game Development (LibGDX) | Episode 6 - Adding a button to our menu

preview_player
Показать описание
In this episode, we finally add a button to our menu. Just the button, but it fills 30 minutes, sorry for that. Next episode we're going to add the heading and functionality and then there's no more to explain about the menu.

Thanks for watching!

stay tuned @dermetfan
Рекомендации по теме
Комментарии
Автор

I'll be sure to! After all, you'll be the person I'll be thanking for me getting the majority of my knowledge on LibGDX. Also, the TextureAtlas was a little confusing, but I think I get it now. I think it's basically just defining all of the images we are going to use in our game. Like the button.pack: It has all the "states" of our button, and the TextureAtlas recognises that and stores all the button states.

It's a shame you've never made a full game, but hopefully one day you will :)

sonickk
Автор

Recieve a sext in the middle of episode. Interesting conversation indeed.

gothikaboy
Автор

You could create an abstract class called UIFactory or something with a bunch of static methods returning the things you want, but I don't see the need for this.
In episode 9, we won't have to create a TextButtonStyle anymore because we can put it (and other styles) into a skin file using JSON. This allows to create a button with a listener in two lines, which is short enough in my opinion :)

dermetfan
Автор

Thanks dermetfan! These tutorials are great! I want to make a platformer in LibGDX eventually and maybe(way in the future) a 3D game! I'm curious though, have you ever made any games in LibGDX? I'd love to play one! :)

sonickk
Автор

+Michael Ellis The API was changed, try _stage.setDebugAll(true)_ instead.

dermetfan
Автор

i will like your all tutorial that i watch :D

trantrinh
Автор

Thank you and good luck with your game! Tell me when there's a playable version :)
In all the time I've been programming, I actually never finished a game. Once I knew how to do it, I never had the patience to wait until the game is done before I can learn something new. I'd like to write a complete game some day, though.

dermetfan
Автор

The exception says "Missing LabelStyle font". This means that you probably forgot to set
textButtonStyle.font = black;

Or according to the annotations in previous videos:
textButtonStyle.font = white;
textButtonStyle.fontColor = Color.BLACK;

dermetfan
Автор

My computer doesn't like "Table.drawDebug(stage);" It's spelled and capitalized exactly like that, I can't import anything else, and 'stage' is a Stage. It says drawDebug wants a ShapeRenderer and that 'stage' isn't applicable. I've been copying your code word for word. Any ideas?

michaelellis
Автор

thanks! i fixed it with

textButtonStyle.font = white;
textButtonStyle.fontColor = Color.BLACK;

OppaHansi
Автор

"we want the whole fucking quality" hahah good tutorial

swattkidd
Автор

Are you planning on showing off some of the other Scene2d UI elements such as the Windows or Sliders?

sonickk
Автор

I decided not to include the tween fade for the splash, but that means i have no delay option. So now it just quickly displays the splash then immediately shows the exit button. How could I make it so the splash stays for an amount of time before going to the main menu? I tried using thread.sleep but the splash still flashed; it did not hold it.

Great channel, Thanks!

ZymosisSR
Автор

23:26 Maaan!! Swear i was imagining that you were drinking whisky for the last 3 episodes!! I was hoping to hear you drunk and cursing at some complicated code or something in a future episode.. xD

marianomdq
Автор

A note to people watching: The 9 patch program automatically adds the .9 extension for you. Not important but worth noting :)

sonickk
Автор

Simple way: Draw some background image before you draw the Stage.
scene2d.ui-like way: Add a background Drawable to the Table using You can get this Drawable from the Skin (which I introduce in later episodes) or by creating a SpriteDrawable.

dermetfan
Автор

Hey man, do you mind if I ask you a question? Where did you learn libgdx from, from their website or somewhere else? Thank you

_trashcan_
Автор

Something like but instead of moving scaling the text? Making the effect that the button is being pressed against the screen?

nierga
Автор

I have a problem. Both my player and my stage need to have input processors, but there can only be one. How can I be able to click buttons around the side, but still be able to control my player?

kylejensen
Автор

This seems like a lot of struggle for just creating a button. Coulnd't I just get into paint/ps, draw myself a button and then set the properties for it in libGDX without having to use the texturepacker/the "draw 9 patch" thingy etc? Is this really the easiest way of doing it 2 years after this video was made?

lillagubbn