0 votes

So, a bit like how games such as GTA snows on christmas and Minecraft's chests look like presents on Christmas Eve/Day/Boxing Day, I was wondering if there was a way i could implement some thing like this into my game?
What I want to happen is, the main menu background to change as different seasons occur:

In Autumn there are leaves falling (particles)

In winter the trees will have bits of white on them to represent snow and there will be snow particles

In spring there will be a bright sun behind the clouds and there will be animals flying

In summer the sky will be bare with just the sun and the leaves will be a darker green

This will also happen in-game, where the tiles/trees will have leaves/snow/flowers/grass on them, depending on the season.

I think that timers will be able to do this, but I was thinking that maybe there is a plugin available that allows me to implement certain things on certain dates(like a calendar outside of the actual game).

in Engine by (308 points)

1 Answer

0 votes

you can use this functions of the OS object

var dateDict = OS.get_date()

Dictionary get_date ( bool utc=false ) const
*Returns current date as a dictionary of keys: year, month, day, weekday, dst (Daylight Savings Time).*

Dictionary get_datetime ( bool utc=false ) const
*Returns current datetime as a dictionary of keys: year, month, day, weekday, dst (Daylight Savings Time), hour, minute, second.*

by (4,078 points)

Could you possibly say how I would implement this into a function? Thanks

func _ready():
    var dateDict = OS.get_date()
    if dateDict["day"] == 24 and dateDict["month"] == 12:
        print("Ho Ho Ho")

Thank you so much! This works perfectly, all I had to do extra was to make the trees automatically invisible and on certain months only show one. Again, thank you!!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.