Basic Layouts
-
I am building a system and I need to be able to put presentations that automatically go onto the next slide. Can anyone give any tips/ideas on how to do this ?
-
If you are only using images for each slide, then a simple method would be to use a variable (number) to keep track of which slide you're on. Make the picture change according to the variable. Finally, make it so the variable increases when a key is pressed, or perhaps you could put it on a timer to make it increase automatically.
I do not know any details about your plans, so feel free to write a response if you have any trouble or if I missed anything.
-
@lemu_kymoh I am new to this and thanks for the input it is greatly appreciated.
I have my basic layout. It is for a small team to display info on a matchday and also promote their sponsors. So the timer idea is exactly what I need for the sponsors information to advertise their products whilst they are there.
What type of box would I require and how could I set the timers and create this ?
-
I apologize I actually do not use Godot much. But I was able to tinker around and figure out an easy way to achieve your goal about the sponsors.
Also, I am assuming when you say "box" that you mean "nodes." I only used the Node2D and the AnimatedSprite2D. Here is the step-by-step:- Create the root node for 2D scene (top left)
- Add the AnimatedSprite2D by clicking on the + at the top left, you can search up "AnimatedSprite2D" and it should come up.
- Notice the yellow warning sign next to it, it says that you need to set the frames.
- Now go over to the inspector (far right)
5.Click on "Animation" then click on the "Sprite Frames" and create a new SpriteFrames.
6.Now on the bottom you may see the animation editor. If you don't see it, just click on SpriteFrames again to make it pop up.
7.From here you can start dragging photos from your folders and into your game files (bottom left).
8.Once you finish adding your slides, you can then drag those (from the game files) into the animation editor.
9.You can configure the duration for each, make it autoplay, stop looping, etc.
10.Press play to test it out!
I'm hoping this is what you are looking for, it requires no programming and is very simple.
-
-
Hi lemu_kymoh, thank you so much for the help. After a while of adjusting I got it working and was so pleased with the results.
I have so many things I want to do and hope you would not mind sharing your knowledge if you can.
Helps me learn also as I play with it more
-
No problem! If you have any other questions or problems then feel free to ask and I will try my best to find a solution!
-
Thanks, a couple for you
When you have boxes and you want to put a header as one style and the rest as another style. How would you do that ?. I tried putting a box within a box. It worked but got very messy.Also, the spinbox is handy for scores of the teams. But I cannot see how to increase the font size ??.
Any guides are appreciated
-
The spinbox font size can be changed by adding a theme to it.
- In the inspector (far right), look for theme. Click on the <empty> button and make a new theme.
- Now on the bottom you will see the theme preview (similar to the animation editor from before). If you don't see it, just click it again.
- In the inspector you can now change the font size
-
As for your other question, I still don't know what you mean by "boxes." Do you mean text? Next time I would recommend adding a screenshot of your work so it is easier to see what is happening.
Anyways, changing styles looks a bit difficult but is quite simple. I am assuming you are using the RichTextLabel for your text.First off, make sure you have BBCode enabled for the text.
Next, to change text styles, you have to use brackets with a specific property inside, [] surrounding the text. Any text coming after the brackets is affected by them, and it stops getting affected once you add another set of brackets with a slash [/].
A bit confusing, I know. Let me give an example instead of trying to explain:[b] this text is bolded because of the brackets at the start. [/b] But this text is not, since the other brackets ended the bolding.
Here is a link about BBCode. Scroll down to "Reference" and you will see the different types of properties you can put inside the brackets. https://docs.godotengine.org/en/4.1/tutorials/ui/bbcode_in_richtextlabel.html
It still might be confusing so if you don't understand then let me know. -
-
Hi lemu_kymoh,
Hope you are having a great holiday period and spending time with friends and family.
Thanks for the help so far. It has been interesting getting to play about with the features. Unfortunately over Christmas it was tough as obviously the time of year very much takes over our lives.
I was wanting to develop a game but unsure of a few things I want to do. I was hoping you could help me develop this. The aim is to develop a card game which can be fun for all different people. It is based on a game that was on television many years ago. I will explain the instructions below:
- The first card on the left of the top row gets displayed at random (it would need to be retrieved from a folder containing all the playing cards)
- You have to go guess the next card all the way to the end of the 3rd row. Each time you click on the card it changes to a random card form the folder.
- At the end of the top row. The last card chosen at random gets displayed on the 2nd row first card space.
At the end of the second row. The last card chosen at random gets displayed on the 3rd row first card space. - The cards can never be duplicated after it has been displayed until the first card has been selected at random to restart the game. This essentially is the reset.
I assume this is possible ??.
-
extends Node
var deck = [] # Array to hold the cards
var currentCard = 0
var currentPlayerGuess = 0 # 0 for lower, 1 for higherfunc _ready():
# Initialize the deck of cards
# Populate the deck with card values (e.g., 1 to 52 for a standard deck)
for i in range(1, 53):
deck.append(i)shuffle_deck() # Shuffle the deck draw_card() # Start the game by drawing the first card
func shuffle_deck():
# Function to shuffle the deck
deck.shuffle()func draw_card():
# Function to draw a card and update the UI
var cardValue = deck[currentCard]
# Display the card value in your game UIfunc on_lower_button_pressed():
# Function to handle when the "Lower" button is pressed
currentPlayerGuess = 0
check_guess()func on_higher_button_pressed():
# Function to handle when the "Higher" button is pressed
currentPlayerGuess = 1
check_guess()func check_guess():
# Function to check the player's guess
var nextCardValue = deck[currentCard + 1]
if (currentPlayerGuess == 0 and nextCardValue < deck[currentCard]) or
(currentPlayerGuess == 1 and nextCardValue > deck[currentCard]):
# Player guessed correctly
# Update UI, maybe move to the next card, and continue the game
currentCard += 1
draw_card()
else:
# Player guessed incorrectly
# Handle game over logic, display result, reset, etc.
passI found this and it says it is basic. I will need to see how it progresses as I might need your help to clarify a few steps if that is ok
-
That looks great so far!
By the way, to change the sprite of the card when revealing it,
texture = load("path to texture")
is a useful trick. To get the path you need to go to the files (bottom left), right-click on the file, and click Copy Path.
https://forum.godotengine.org/t/load-texture-from-file-and-assign-to-texture/22655 -
I am literature lover from Pakistan. I read the short, "Waiting for Godot." I was overwhelmed by the emotions and then searched godot and this community came next to me. I have no affair with wen development etc, but I hope here I will Learn something. Positive vibes for all friends
-
Hi @lemu_kymoh where would I put it in the script for this ?
Also, there appears to be an issue with the script that I cannot see why it is flagging it up ??.
-
The error you are getting is because the entire "if" statement needs to be in one line.
From your screenshot, you can see that after "or" in line 38, you made it a new line, which gives the error.It is very important to understand that GDscript, similar to Python, relies heavily on white space (indents, spaces, lines). So if you accidentally press enter or tab on the wrong place, the computer won't understand it and give an error.
-
You are a legend, for the script "texture = load("path to texture")" where would you normally insert this into. I read the little section you sent to me. I am slightly confused. So you can pull the pictures from a folder you create ?
-
Yep, the code lets you change the picture of the item later, during the game.
You would put it in the script for whichever items need to change their picture.So for example, I am guessing your card items will change pictures during the game, so you would set up textures for each card. Then, you can change the current picture:
var new_picture = load("res://new_pic.png")
$Sprite2D.texture = new_picture -
Hi @lemu_kymoh
Is it possible to have text that is too much for a box to be scrolling automatically and once it gets to the end, it simply repeats again ??.